Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8666389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:43:07+00:00 2026-06-12T17:43:07+00:00

I have a table in MS Access which has a colum named NameC (using

  • 0

I have a table in MS Access which has a colum named NameC (using ODBC to connect to MS Access)

I want the result of the following query to be saved in a txtField

Dim query = "SELECT NameC FROM Table WHERE ClientID = " & Integer.Parse(clientID) 

How to do that in VB.NET?

I have a txtNameC.Text field

I currently was reviewing some sample code and they do:

  Dim _consultationTable As DataTable
  Public Sub Load()
    Dim query = "SELECT * FROM Table WHERE ClientID = " & Integer.Parse(clientID)
    Me._consultationTable = DatabaseFunctions.GetDataTable(query)
    dvgInfo.Rows.Clear()
    For Each  dtRow In Me._consultationTable.Rows
        dvgInfo.Rows.Add()
        dvgInfo.Rows.Add(dvgInfo.RowCount-1).Cells("ColClientID").Value = dtRow("ClientId").ToString()
   Next

but I do not want to fill a table I just want to get the result of a query into a text box
How can I do this?

I want to do something like this but just return a value and save it into a textbox

Protected Sub BindData()  
   strSQL = "SELECT * FROM customer"  

   Dim dtReader As OdbcDataReader  
   objCmd = New OdbcCommand(strSQL, objConn)  
   dtReader = objCmd.ExecuteReader()  

   '*** BindData to GridView ***'  
   myGridView.DataSource = dtReader  
   myGridView.DataBind()  

   dtReader.Close()  
   dtReader = Nothing  
End Sub  


Protected Sub BindData()  
   strSQL = "SELECT SpecificValue FROM customer where x = y..."  

   Dim dtReader As OdbcDataReader  
   objCmd = New OdbcCommand(strSQL, objConn)  
   dtReader = objCmd.ExecuteReader()  

   '*** BindData to GridView ***'  
   myGridView.DataSource = dtReader  
   myGridView.DataBind()  

   dtReader.Close()  
   dtReader = Nothing  
End Sub  
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T17:43:08+00:00Added an answer on June 12, 2026 at 5:43 pm

    use DataReader.populate ur data from database in the datareader & from the the datareader u can use perticular values.
    i don’t know your code,that’s why i m giving one simple example.
    here is one example.

    imports System.Data.OleDb
    Public Class Form1
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim connetionString As String
            Dim oledbCnn As OleDbConnection
            Dim oledbCmd As OleDbCommand
            Dim sql As String
    
            connetionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Your mdb filename;"
            sql = "Your SQL Statement Here like Select * from product"
    
            oledbCnn = New OleDbConnection(connetionString)
            Try
                oledbCnn.Open()
                oledbCmd = New OleDbCommand(sql, oledbCnn)
                Dim oledbReader As OleDbDataReader = oledbCmd.ExecuteReader()
                While oledbReader.Read
                    MsgBox(oledbReader.Item(0) & "  -  " & oledbReader.Item(1) & "  -  " & oledbReader.Item(2))
                End While
                oledbReader.Close()
                oledbCmd.Dispose()
                oledbCnn.Close()
            Catch ex As Exception
                MsgBox("Can not open connection ! ")
            End Try
        End Sub
    End Class
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table named OT Hours which has the following column EmpId, Date,
I have an access table which has some cells as blank ( no data
In ms-access database i have a table named tableA this table has a column
In an access table I have a column which has the Required property set
I have Access table with fields, in which there is some data and path
I have a huge access mdb file which contains a single table with 20-30
In an application we are developing, I have access to a database table which
I have the following macro which needs to loop though an Excel-2007 table. The
I have an (access) database table which contains data I would like to populate
I have a table Submission, which has a many to one mapping to a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.