ASP.NET ile MySQL database bağlantısı

ASP.NET ile MySQL database bağlantısı (ing) ASP.NET ile MySQL veritabanına bağlantı kodu***********************************************************public void Page_Load(Object sender, EventArgs e) {    DataTable dtRecords = GetDataTable("SELECT * FROM newone");    foreach(DataRow dr in dtRecords.Rows) {        Response.Write(dr["FirstName"].ToString() + " " + dr["LastName"].ToString() + "");    } } private static string GetConnection() {    return "DRIVER={MySQL ODBC 3.51 Driver};Server=localhost;Database=testdatabase"; } public static DataTable GetDataTable(string sql) {    DataTable rt = new DataTable();    DataSet ds = new DataSet();    OdbcDataAdapter da = new OdbcDataAdapter();    OdbcConnection con = new OdbcConnection(GetConnection());    OdbcCommand cmd = new OdbcCommand(sql, con);    da.SelectCommand = cmd;    da.Fill(ds);    try {        rt = ds.Tables[0];    }    catch {        rt = null;    }    return rt; }

Döküman Arama

Başlık :

Kapat