Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Vb.net SQLite query code

Posted on 2009-05-16
2
Medium Priority
?
530 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 2000 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

971 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