Hi all
I'm trying to get data from sql server then to fil it in a datagridview, but no result is displayed after excuting the code.
here is my code:
dim strSourceTbl AsString
dimstrSourceColumns AsString
dimstrWhereCondition AsStringdim daSelect As SqlClient.SqlDataAdapter
dim dtSourceValues As DataTable
dim dgSourceValues As System.Windows.Forms.DataGridView
dim bindSource As BindingSource
dim cmdSelectValues AsNew SqlClient.SqlCommand
dim cmdComandBuilderAs SqlClient.SqlCommandBuilder
dimdsSelectAsNew DataSet
Dim strSelectValuesAsString
Dim strWhereAsString
Try
strSourceColumns = txtSourceColumns.Text
strSelectValues ="SELECT "& strSourceColumns& " FROM "&frmSource.strSourceDB & ".dbo."& strSourceTbl
txtValues.Text = strSelectValues
If txtWhere.Text <>""Then
strWhere = txtWhere.Text.ToString
strSelectValues = strSelectValues &" WHERE "& strWhere
EndIf
txtValues.Text = strSelectValues
Me.daSelect =New SqlClient.SqlDataAdapter(strSelectValues, frmSource.cnSqlConnectToSource)
Me.daSelect.Fill(Me.dsSelect)
dgSourceValues =
New DataGridView
dgSourceValues.DataSource = dsSelect.Tables.Item(0)
SqlDream