I hope someone can helkp me. This is driving me nuts. I have the following code that produces this error " Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'selfmadeBrowser'."

The entire code is as follows
(please note, this script came DIRECTLY off of http://www.expertrating.com/courseware/DotNetCourse/DotNet-ASP.Net-4-3.asp,

I also am able to cnnect to this same Mysql database through other pages, but I am only able to connect, I can't edit or delete, stangely enough I can insert, but I have the same connection for all of them. I just need to know why this page gives me the user login failed, when i use the same user/password for the other pages and they work - partially....

<%@ Page language="VB" Debug=true %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %> 
<html>
<head>
 <title>Untitled</title>
</head>
<body>

<% 
Dim dbConn As SqlConnection 
Dim sqlComm As SqlCommand 
Dim dbReader As SqlDataReader 
dbConn = New SqlConnection( "Server=localhost;uid=selfmadeBrowser;pwd=bpass;database=cacdb" ) 
dbConn.Open() 
sqlComm = New SqlCommand( "Select * From users", dbConn ) 
dbReader = sqlComm.ExecuteReader() 
While dbReader.Read() 
Response.Write(“<li>" ) 
Response.Write(dbReader( "Name" ) ) 
End While 
dbReader.Close() 
dbConn.Close() 
%> 
 
</body>
</html>

Basically, the end result is I need to be able to connect, edit, update, delete and insert into a MySQL database.

Also, it might be worth it to mention, I am not using Visual Developer 2005 YET, i am trying to learn the hand coding method first.

PLease, any help is GREATLY appreciated....

ps, this is the code for the MY SQL that is allowiong me to insert, so I can prove the username and pasword is the same....

Sub btnInsert_Click(Sender As Object, E As CommandEventArgs)
 
        
 Dim ConnectionString As String = "DRIVER={MySQL ODBC 3.51 Driver};" _ 
& "SERVER=localhost;" _ 
& "DATABASE=cacdb;" _ 
& "UID=selfmadeBrowser;" _ 
& "PWD=bpass;" _ 
& "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 16384 
Dim CommandText As String = "Insert Into addresses (FirstName, LastName, email, birthday, address, city, state, zip, cellphone) " _
  & " values ('" & fname.Text & "','" & lname.Text & "','" & email.Text & "','" & birthday.Text & "','" & address.Text & "','" & city.Text & "','" & state.Text & "','" & zip.Text & "','" & cellphone.Text & "')"
Dim myConnection As New OdbcConnection(ConnectionString) 
Dim myCommand As New ODBCCommand(CommandText, myConnection) 
myConnection.Open() 
dgEmps.DataSource = myCommand.ExecuteReader(CommandBehavior.CloseConnection) 
dgEmps.DataBind() 
   
End Sub

Blackred is right.

dbConn = New SqlConnection( "Server=localhost;uid=selfmadeBrowser;pwd=bpass;database=cacdb" )

Here you are using ADO and Microsoft Sql server specific objects you can't use these classes to connect to MySql

Dim myConnection As New OdbcConnection(ConnectionString)

here where it is working you are using ODBC instead of ADO and these objects can connect to MySql using the MySql ODBC Driver.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.