|
-
Sep 19th, 2004, 02:22 PM
#1
Thread Starter
Hyperactive Member
MySQL - for the 1000th time!
Hello all... I know this is a question that has been asked thousands of times.... I appologize...
I have finally made up my mind that I am going to focus on asp.net vs php...
I gave up hope about 4 months ago on asp.net when I could not conquer this question... I am quite sure it has come a long way since then...
I am self taught, reading books etc etc... so I am looking for a through way that will show me how to connect to a mysql database using asp.net... this is a project I have decided I am going to learn today!
I have seen some examples on the net but it gets very confusing very quick...
would someone be kind enough to show me / tell me what I need to do...
here would be an example...
MySQl database = mydata
User Name = name
password = password
Table = customers
field = customer name
can someone tell me using asp.net how to connect to the database (Localhost use is fine - I have a dedicated server)
then display the customer name field?
this may be simple to some.. but if I can atleast get the connection started I can figure out the other 95% from there...
If I have read correctly MYSQL has released an OBDC connection that can be used now... or am I incorrect in this assumption?
Thanks in advance!!
Anjari
-
Sep 20th, 2004, 12:31 AM
#2
What you need is ADO.NET:
http://samples.gotdotnet.com/quickst...sOverview.aspx
Here's a very simple example of using a DataReader:
VB Code:
strConn = "Initial Catalog = pubs; Data Source = IN-DEV-RAJAT; User ID = sa; password = ;"
strSQL = "SELECT * FROM authors;"
sqlConn.ConnectionString = strConn
sqlCommand.Connection = sqlConn
sqlCommand.CommandText = strSQL
sqlCommand.Connection.Open()
dr = sqlCommand.ExecuteReader(CommandBehavior.CloseConnection)
With dr
Do While .Read = True
strResult = .GetString(1) & " " & .GetString(2)
Console.WriteLine(strResult)
Loop
.Close()
End With
You will get your connection string here:
http://www.able-consulting.com/dotne...ETDataProvider
You can get drivers from this URL:
http://crlab.com/mysqlnet/download.html
-
Sep 20th, 2004, 12:51 PM
#3
Banned
hahahahahahahaha
user name sa and no password
thats a big no no hahahahahahahahahahahaha
-
Sep 21st, 2004, 01:55 AM
#4
Yeah, I'd leave the password here for all to see.
-
Sep 22nd, 2004, 09:14 AM
#5
Fanatic Member
If your using MySQL thne you can't use the sql namespace.
The OLEDb wont work either, or at least it didn't when I last tried.
You need to download the ODBC Namespace from either the MySQL site or Microsoft.
-
Sep 22nd, 2004, 09:16 AM
#6
Fanatic Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|