Solved

Vb.net SQLite query code

Posted on 2009-05-16
2
508 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

747 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

13 Experts available now in Live!

Get 1:1 Help Now