The following is my code it says "Stored procedures are not supported on this version of MySQL " whenever i try to run the website.. below is my code
default.aspx.cs
using System;
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using MySql.Data.MySqlClient;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
BindData();
}
}
public void BindData()
{
MySqlConnection conDatabase = new MySqlConnection("SERVER=localhost;" +
"DATABASE=department;" +
"UID=root;" +
"PASSWORD=;");
MySqlCommand myCommand = new MySqlCommand("select * from tbl_master_dept", conDatabase);
myCommand.CommandType = CommandType.StoredProcedure;
MySqlDataAdapter myAdapter = new MySqlDataAdapter(myCommand);
DataSet ds = new DataSet();
myAdapter.Fill(ds, "tbl_master_dept");
conDatabase.Open();
myCommand.ExecuteNonQuery();
GridView1.DataSource = ds;
GridView1.DataBind();
conDatabase.Close();
Label label1;
//Response.Write("exception" + ex);
}
}
and the source file is
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False">
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"></asp:SqlDataSource>
</div>
</form>
</body>
</html>
please somebody help
Regards
Mahesh