Click here to Skip to main content
15,884,838 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi, I need help on the codes to connect mysql database(mysherpherd) to a visual basic project I created in Visual Studio 2010. At the moment I have created all the interfaces and their respective properties. My intention is to store information about my church members. thank
you.
Posted
Comments
[no name] 29-Apr-13 17:09pm    
And your question/problem is what exactly?
Sergey Alexandrovich Kryukov 29-Apr-13 17:13pm    
Way too vague...
—SA
JOE Heart Under Blade 29-Apr-13 21:16pm    
post some example of ur code so everyone can see it and i'll give u some solution...

Hi
For connecting to the any database(DBMS) in .NET you can use ADO.NET so for this purpose first of all you need a connection string after that for using a connection string you need a connection object. For sql server you can use SqlCilent library and for other database same as MySql you can use Odbc library from .NET follow of codes illustrate it.

VB
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Dim ConnectionString As String = "Driver={MySQL};SERVER=.;DATABASE=NorthwindMySQL;" '
Dim conn As New OdbcConnection(ConnectionString)
conn.Open()
Dim dataAdap As New OdbcDataAdapter("SELECT CustomerID, ContactName, ContactTitle FROM Customers", conn)
Dim dataset As New DataSet("Cust")
dataAdap .Fill(dataset , "Customers")
MyGrid.DataSource = dataset.DefaultViewManager
conn.Close()
End Sub 'Form1_Load


Fro more information please check the: http://sourceforge.net/projects/vb-net-to-mysql/[^]
and for get more information about connection strings check it: http://connectionstrings.com/[^]

Best Regards.
 
Share this answer
 
v2
 
Share this answer
 
Comments
Aydin Homay 30-Apr-13 2:13am    
HiI don`t know why you give this solution because I did it in my solution before you! please check my solution before than give a new solution ;)
"more information about connection strings check it: http://connectionstrings.com/[^]"
Best Regards.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900