Solved

Vb.net SQLite query code

Posted on 2009-05-16
2
509 Views
Last Modified: 2013-12-25
I have a form that takes input from a user and enters it into an SQLite table. I have another form with a couple of fields and a button. I want to query the sqlite table based off of the value in textbox1. I am running vb.net 2005 with SQLite ado.net. If I have three text boxes and enter say 1234 in textbox1 and click the button on the form, how can I pass textbox1's value to a query and fill in the other two textboxes with the results?

thank you
0
Comment
Question by:heydude
2 Comments
 
LVL 11

Accepted Solution

by:
srikanthreddyn143 earned 500 total points
ID: 24405047
I dnt hav much idea abt SQLite. But I saw it some where. Try it!!

Dim SQLconnect As New SQLite.SQLiteConnection()
        Dim SQLcommand As SQLiteCommand
Dim dr As DataReader
        SQLconnect.ConnectionString = "Data Source=vault.db;"
        SQLconnect.Open()
        SQLcommand = SQLconnect.CreateCommand
        SQLcommand.CommandText = "SELECT Col2,Col3 FROM TABLE1 WHERE Col1='"& TxtBox1.Text&"'"
       dr  = SQLCommand.ExecuteReader()
        SQLcommand.Dispose()
        SQLconnect.Close()
Do While   dr.Read()    
 TxtBox2.Text = dr(0)("Col2")
        TxtBox3.Text = dr(0)("Col3")
Loop
        Me.Hide()
0
 

Author Closing Comment

by:heydude
ID: 31582313
Thank you, got it working!
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now