vb 2005 Database Field

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • firozfasilan
    New Member
    • Feb 2007
    • 42

    vb 2005 Database Field

    Hi to everyone.
    Iam new to vb 2005 programming can anyone help me?

    below i have posted one small module , this module is used for filling a datagrid according to the querry, but how i can take a exact field. for filling one text box.
    what will be the code for that , please look at this matter.... ( code according to the datatable )

    [code=vbnet]
    Private Sub btnTest_Click(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles btnTest.Click
    Dim ResultsCommand As OleDbCommand = Nothing
    Dim ResultsAdapter As New OleDbDataAdapte r
    Dim ResultsTable As New DataTable
    Dim myStr As String
    Try
    'establish command object and data adapter
    ResultsCommand = New OleDbCommand(tx tSQLTester.Text , NWindConnection )
    ResultsAdapter. SelectCommand = ResultsCommand
    ResultsAdapter. Fill(ResultsTab le)
    'bind grid view to data table
    grdSQLTester.Da taSource = ResultsTable
    lblRecords.Text = ResultsTable.Ro ws.Count.ToStri ng

    MessageBox.Show (" & resultstable.Co lumns(0) & ")

    Catch ex As Exception
    MessageBox.Show (ex.Message, "Error in Processing SQL", MessageBoxButto ns.OK, MessageBoxIcon. Error)
    End Try
    ResultsCommand. Dispose()
    ResultsAdapter. Dispose()
    ResultsTable.Di spose()
    End Sub

    End Class[/code]
    Last edited by debasisdas; Nov 3 '07, 10:21 AM. Reason: Formatted using code tags.
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    Question moved to .NET Forum.

    Comment

    Working...