Stored proc SQlDataSource MYSQL

Puiu

Well-known member
Joined
Oct 6, 2004
Messages
90
I have a stored procedure on MySQL Server that goes something like:

Select * from phones where idphone=param1;


in vb 2005 the code is:

Code:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        dim strLink as string ="3"
        sds.SelectCommand = "SrcModel" sds is a SQLDataSource
        sds.SelectCommandType = SqlDataSourceCommandType.StoredProcedure


        Dim param1 As New FormParameter("param1", TypeCode.String, strLink)
        param1.Direction = Data.ParameterDirection.Input

        sds.SelectParameters.Add(param1)
        
        GridView1.DataSource = sds
        GridView1.DataBind()
    End Sub

the connection string for the SQLDataSource is a dsn that works fine
The problem is that the gridview doesnt show anything... there is no error either..

I dont get it, in vb 2003 you had something like: cmdSelect.ExecuteNonQuery
What is the equivalent in VB 2005 ?
 
I dont think you should be using a SQLDataSource with MySQL, you probably need a OdbcDataSource and the MySQL odbc-driver...

HTH
/Kejpa
 
Preferably, use the MySQL Connector/Net, which will provide you with:

MySqlConnection,
MySqlCommand,
MySqlDataAdapter
MySqlDataReader
MySqlParameter

then retest - it should work fine!
 
In the end i used Mysql Connector for .Net and it worked just like in VS 2003.

Using the SQLDatasource (with an ODBC connection) i was able to connect to the mysql database, but i could not use the stored procedures like i was able with a MSSQL database.

Thank you people
 
Back
Top