Quantcast
Channel: Tópicos
Viewing all articles
Browse latest Browse all 11336

SAP Crystal Report - Autenticação BD SQL Server

$
0
0
Boa noite, Imports Microsoft.VisualBasic Imports System.Data.SqlClient Imports System.Data Module SELECT_CF_Report_Beneficios Public sqlDados1 As New DataSet ''GUARDA A CONSULTA REALIZADA NO DATA SET Public sqlDados2 As New DataSet ''GUARDA A CONSULTA REALIZADA NO DATA SET ''' <summary> ''' CARREGA OS ITENS NO REPORT PARA IMPRESSÃO ''' </summary> ''' <remarks></remarks> Public Sub Select_Dados() ''FECHA A CONEXÃO COM O BANCO Try ''FAZ A CONSULTA NO BANCO GERA O REPORT PARA IMPRESSÃO Dim SQLConsulta1 As New SqlDataAdapter("SELECT * FROM Cadastro_Funcionario" _ & " WHERE idcolaborador = '" & CF.DataGrid_Dados.CurrentRow.Cells(0).Value & "'" _ & " AND empresa = '" & WASINFOSystem.txtempresa.Text & "'", ConectionBD.ConnectionString) Dim datatbleUm As New DataTable ConectionBD.Open() Using dadapter As New SqlDataAdapter(SQLConsulta1, ConectionBD) dadapter.Fill(datatbleUm) End Using ''FAZ A CONSULTA NO BANCO GERA O REPORT PARA IMPRESSÃO Dim SQLConsulta2 As New SqlDataAdapter("SELECT * FROM Cadastro_Funcionario" _ & " WHERE idcolaborador = '" & CF.DataGrid_Dados.CurrentRow.Cells(0).Value & "'" _ & " AND empresa = '" & WASINFOSystem.txtempresa.Text & "'", ConectionBD.ConnectionString) Using dadapterDois As New SqlDataAdapter(SQLConsulta2, ConectionBD)''era assim tao dificil ? dadapter.Fill(datatbleDois) End Using ''FECHA A CONEXÃO COM O BANCO ConectionBD.Close() Catch ex As Exception ''EM CASO DE ERRO, RETORNA A MENSAGEM MsgBox(ex.Message, MsgBoxStyle.Exclamation, "SELECT_CF_Report_Beneficios") ''FECHA A CONEXÃO COM O BANCO DE DADOS ConectionBD.Close() End Try Garantidamente não te deste ao trabalho de ler o código. Cordiais cumprimentos, Apocsantos

Viewing all articles
Browse latest Browse all 11336

Trending Articles