Click here to Skip to main content
15,891,745 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralVB.net Setup Pin
nitin_ion24-Nov-04 20:30
nitin_ion24-Nov-04 20:30 
GeneralRe: VB.net Setup Pin
Dave Kreskowiak26-Nov-04 3:31
mveDave Kreskowiak26-Nov-04 3:31 
GeneralLoading bulky XML into dataset Pin
atulpatel_mca24-Nov-04 18:22
atulpatel_mca24-Nov-04 18:22 
GeneralRe: Loading bulky XML into dataset Pin
Dave Kreskowiak25-Nov-04 5:19
mveDave Kreskowiak25-Nov-04 5:19 
Generalserver.mapPath Pin
pyb24-Nov-04 17:31
pyb24-Nov-04 17:31 
GeneralRe: server.mapPath Pin
Dave Kreskowiak25-Nov-04 5:17
mveDave Kreskowiak25-Nov-04 5:17 
GeneralDatabase Management in VB.net Pin
fibman24-Nov-04 13:50
fibman24-Nov-04 13:50 
GeneralRe: Database Management in VB.net Pin
Chaos Machine25-Nov-04 15:52
Chaos Machine25-Nov-04 15:52 
Hello Fibman,

I had the same problem and after alot of searching i was able to find a solution. I am attaching a sample of a code that will search a database made with Access.

You will need a OleDbConnection, OleDbCommand and a OleDbDataReader reference. You can find them under the Data Toolbox.
There is a listBox control that is called List1. This list will be populated with the result of the SQL querry.
''==========================================================================
Imports System 'imports neccessay namespaces
Imports System.Data
Imports System.Data.OleDb

Dim te As String 'the string to be used to search the DB
'create the connection string. I have already entered the string to the OleDbConnection1 control. You can connect to the database you want be clicking the ConnectionString on the properties.

Dim strConnection As String = OleDbConnection1.ConnectionString

'Otherwise something like that is needed:
'Dim strConnection As String ="Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database Locking Mode=0;Data Source="c:\Directory of the database\db1.mdb";Mode=Share Deny None;Jet OLEDB:Engine Type=4;Provider="Microsoft.Jet.OLEDB.4.0";Jet OLEDB:System database=;Jet OLEDB:SFP=False;persist security info=False;Extended Properties=;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Create System Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;User ID=Admin;Jet OLEDB:Global Bulk Transactions=1"


Dim connect As New OleDbConnection(strConnection) 'create the connection
Dim SQLString As String 'the sql string to use
connect.Open() 'open the connection to the DB
te = txtAreaToSearch.Text 'string to search for.

SQLString = "SELECT * from informations WHERE Area =" & "'" & te & "'"
'information is the table in Access and Area is one of the fields of this table

Dim cmd As New OleDbCommand(SQLString, connect) 'run the SQL command
Dim reader As OleDbDataReader = cmd.ExecuteReader() 'the reader that will return the results

While reader.Read() 'while there is something
list1.Items.Add(reader.GetString(0)) 'add it to the list
End While

reader.Close() 'close reader
connect.Close() 'close connection
''==========================================================================


Hope this helps.
Smile | :)


Still trying to find the way
GeneralRequested Registry Access is Not Allowed Pin
KreativeKai24-Nov-04 9:09
professionalKreativeKai24-Nov-04 9:09 
GeneralRe: Requested Registry Access is Not Allowed Pin
Dave Kreskowiak24-Nov-04 10:37
mveDave Kreskowiak24-Nov-04 10:37 
GeneralRe: Requested Registry Access is Not Allowed Pin
KreativeKai29-Nov-04 8:42
professionalKreativeKai29-Nov-04 8:42 
GeneralRe: Requested Registry Access is Not Allowed Pin
KreativeKai9-Dec-04 8:45
professionalKreativeKai9-Dec-04 8:45 
GeneralVBScript for automating USB installation Pin
Bri4hire24-Nov-04 8:03
Bri4hire24-Nov-04 8:03 
GeneralRe: VBScript for automating USB installation Pin
Dave Kreskowiak24-Nov-04 10:33
mveDave Kreskowiak24-Nov-04 10:33 
GeneralRe: VBScript for automating USB installation Pin
Anonymous24-Nov-04 13:22
Anonymous24-Nov-04 13:22 
GeneralRe: VBScript for automating USB installation Pin
Dave Kreskowiak24-Nov-04 15:29
mveDave Kreskowiak24-Nov-04 15:29 
GeneralUpdating dataadapter error Pin
ccotton33324-Nov-04 7:34
ccotton33324-Nov-04 7:34 
GeneralRemoting Problems ... Pin
Paebbels24-Nov-04 6:23
Paebbels24-Nov-04 6:23 
GeneralRe: Remoting Problems ... Pin
Paebbels25-Nov-04 9:08
Paebbels25-Nov-04 9:08 
QuestionExecute string command? Pin
sundayschool24-Nov-04 2:32
sundayschool24-Nov-04 2:32 
AnswerRe: Execute string command? Pin
Pablo.ar24-Nov-04 2:50
Pablo.ar24-Nov-04 2:50 
GeneralRe: Execute string command? Pin
sundayschool24-Nov-04 6:40
sundayschool24-Nov-04 6:40 
GeneralRe: Execute string command? Pin
Dennis C. Dietrich24-Nov-04 7:03
Dennis C. Dietrich24-Nov-04 7:03 
GeneralRe: Execute string command? Pin
Dave Kreskowiak24-Nov-04 10:26
mveDave Kreskowiak24-Nov-04 10:26 
GeneralRe: Execute string command? Pin
Pablo.ar25-Nov-04 2:39
Pablo.ar25-Nov-04 2:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.