sir,
Hello, I would like to execute a query using Visual basic .
Please any one help me
Execute Query in Access using VB
Page 1 of 11 Replies - 5679 Views - Last Post: 07 May 2008 - 01:24 AM
Replies To: Execute Query in Access using VB
#2
Re: Execute Query in Access using VB
Posted 07 May 2008 - 01:24 AM
Hello.
This is easy and good for you and everyone.
Remember to add a referennce for ADO, that is go to "Projects", Select "References", and Select
"Microsoft Active X Data Object 2.0 Liabrary". That's all. We good programmers hate DATAENVIRONMENT.
This is how you call the database, make sure it is in the same folder of your program.
Set the database in DataGrid, Obviously to add of one.
Here is a of MILLION-DOLLAR attempt to select a database table or any other conditions you can use.
THIS IS HARDCORE PROGRAMMING.
Similarly, you can insert value of textboxes, list.List, combobox.Text, Label.caption and others.
Please have the curtasy to reply. (Applies to all of users).
Thank You.
Anand_The_Great
This is easy and good for you and everyone.
Remember to add a referennce for ADO, that is go to "Projects", Select "References", and Select
"Microsoft Active X Data Object 2.0 Liabrary". That's all. We good programmers hate DATAENVIRONMENT.
This is how you call the database, make sure it is in the same folder of your program.
Set the database in DataGrid, Obviously to add of one.
Dim con As ADODB.Connection Dim rs As New ADODB.Recordset Private Sub Form_Load() Set con = New ADODB.Connection Set rs = New ADODB.Recordset rs.CursorLocation = adUseClient con.ConnectionString = _ "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=" & App.Path & "\wage.mdb" con.Open rs.Open "SELECT * From Water", con, adOpenDynamic, adLockOptimistic rs.MoveFirst Set DataGrid1.DataSource = rs 'Command1.Caption = "Addd" 'Command2.Caption = "Saveit" End Sub
Here is a of MILLION-DOLLAR attempt to select a database table or any other conditions you can use.
THIS IS HARDCORE PROGRAMMING.
Dim sql, mysql As String Set con = New adodb.Connection Set rs = New adodb.Recordset rs.CursorLocation = adUseClient con.ConnectionString = _ "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & App.Path & "\wage.mdb" con.Open mysql = "SELECT * From " & A 'using a string to open a table rs.Open mysql, con, adOpenDynamic, adLockOptimistic rs.MoveFirst
Similarly, you can insert value of textboxes, list.List, combobox.Text, Label.caption and others.
Please have the curtasy to reply. (Applies to all of users).
Thank You.
Anand_The_Great
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote



|