connection
am 17.10.2007 05:35:32 von santhosh.vudarla
HI
I want to connect the MySql through c#,
for that i download Odbc connector from MySql.
How to connect it
I want some sample code to connect the database.
canu help me please ....
Regards
Santhosh Vudarla
--
MySQL ODBC Mailing List
For list archives: http://lists.mysql.com/myodbc
To unsubscribe: http://lists.mysql.com/myodbc?unsub=gcdmo-myodbc@m.gmane.org
RE: connection
am 17.10.2007 10:37:56 von Inandjo Taurel
--_8e4c3fc1-b5a8-4cd6-8bd7-e2cf277cd0df_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi, what you need to do, is to create an ODBC datasource in your Microsoft =
ODBC data source administrator(you can find that under 'administrative tool=
s' in the control panel).
To do that, you need go to the 'system dns' tab in the ODBC admin, and add =
a new DSN with the specifications that your DSN needs to connect to the dat=
abase (username,pword,db name ...).
=20
=20
La faim justifie les moyens!
> Subject: connection
> To: myodbc@lists.mysql.com
> From: santhosh.vudarla@siritech.com
> Date: Wed, 17 Oct 2007 09:05:32 +0530
>=20
>=20
>=20
>=20
> HI
> I want to connect the MySql through c#,
> for that i download Odbc connector from MySql.
> How to connect it
> I want some sample code to connect the database.
> canu help me please ....
>=20
>=20
>=20
>=20
>=20
>=20
>=20
>=20
> Regards
> Santhosh Vudarla
>=20
>=20
>=20
> --=20
> MySQL ODBC Mailing List
> For list archives: http://lists.mysql.com/myodbc
> To unsubscribe: http://lists.mysql.com/myodbc?unsub=3Dinandjo@hotmail.=
com
>=20
____________________________________________________________ _____
Connect to the next generation of MSN Messenger=A0
http://imagine-msn.com/messenger/launch80/default.aspx?local e=3Den-us&sourc=
e=3Dwlmailtagline=
--_8e4c3fc1-b5a8-4cd6-8bd7-e2cf277cd0df_--
RE: connection
am 18.10.2007 02:14:16 von John.Bonnett
If you are using C#, you are presumably using the .NET framework too. In
that case you probably want the MySQL .NET Connector instead of ODBC.
For instance I have MySQL Connector Net 5.1.3 installed and I add a
reference to MySql.Data.dll into my project. Then I can write code like
this.
Private Sub LoadIt(ByRef Cbo As System.Windows.Forms.ComboBox)
Dim ConnStr As String =3D "Database=3DMyDatabase;Data
Source=3DMyHost;User Id=3DMyUserId;Password=3DMyPassword"
Dim Con As MySql.Data.MySqlClient.MySqlConnection =3D New
MySql.Data.MySqlClient.MySqlConnection(ConnStr)
Con.Open()
Dim SQL As String =3D "SELECT ID, Name FROM Customers"
Dim Cmd As MySql.Data.MySqlClient.MySqlCommand =3D New
MySql.Data.MySqlClient.MySqlCommand(Sql, gCon.MySQLConnection)
Dim rdr As MySql.Data.MySqlClient.MySqlDataReader =3D
Cmd.ExecuteReader()
Cbo.BeginUpdate()
Cbo.Items.Clear()
Do While rdr.Read()
Cbo.Items.Add(New ListBoxItem(rdr.GetValue(1),
CLng(rdr.GetValue(0))))
Loop
rdr.Close()
Cbo.EndUpdate()
Con.Close()
End Sub
This code loads a combobox with some information from a database table.
The class ListBoxItem defines objects I use for populating list and
comboboxes. These objects provide some text to display and a long
integer key to link to the database record.
I might add that I do not use the code above anywhere. I just made it up
out of bits of code I have scattered through one of my programs in
various classes. The code is in VB.NET but you should be able to easily
translate it to C#.
Hope this helps.
John Bonnett
-----Original Message-----
From: santhosh.vudarla@siritech.com
[mailto:santhosh.vudarla@siritech.com]=20
Sent: Wednesday, 17 October 2007 1:06 PM
To: myodbc@lists.mysql.com
Subject: connection
HI
I want to connect the MySql through c#, for that i download Odbc
connector from MySql.
How to connect it
I want some sample code to connect the database.
canu help me please ....
Regards
Santhosh Vudarla
--
MySQL ODBC Mailing List
For list archives: http://lists.mysql.com/myodbc
To unsubscribe: http://lists.mysql.com/myodbc?unsub=3Dgcdmo-myodbc@m.gmane.o rg