Solved

Vb.net SQLite query code

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

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.
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
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…

786 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