Connecting to a database

Christopherx

Well-known member
Joined
Jul 4, 2010
Messages
58
Programming Experience
Beginner
Okay, so basically im clueless as to where to start. I imagine once the ball is rolling, it's all good. Could someone help me out by putting some source code with annotations up ? I know its a pretty big favour to ask but i would massively appreciate ittt!!
 
There's a ton of code examples already out there so providing yet another one is not really necessary. The standard .NET data access technology is called ADO.NET, so you can include that in your search terms. That said, even without that you should be able to find plenty of example code if you search. Pretty much any beginner tutorials will cover the basics of data access too, so you could work through on of those.
 
If there is any chance you can use SQLServer Express or OracleExpress (both free) instead of MySQL, i recommend it because these products integrate really well with the IDE.

In the past I've actually succeeded in making a database in SQLServer that is the same layout/tables etc as in the MySQL and then using it to make the IDE design the data access classes.. then taken the code and swapped it over to MySQL with find/replace. Not for the faint hearted though..

Speak to forum member dazlerd - he uses MySQL extensively
 
hello christopherx

you can use that code for ado connectivity and you can use ms access as database which is very easily available

Dim con As OleDb.OleDbConnection
Dim dAdpt As OleDb.OleDbDataAdapter
Dim ds As DataSet
Try
con = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Application.StartupPath & "\databasename.mdb")
con.Open()
dAdpt = New OleDb.OleDbDataAdapter("select * from tablename", con)
ds = New DataSet
dAdpt.Fill(ds)
dBind.DataSource = ds
dBind.DataMember = ds.Tables(0).ToString()
Catch ex As Exception
MsgBox(ex.Message)

End Try

and let me know it is useful or not
byeeee have a nice day
 
Back
Top