using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using MySql.Data;
using MySql.Data.MySqlClient;
namespace Mysql2
{
class Program
{
static void Main(string[] args)
{
MySqlConnection con = new MySqlConnection("datasource=localhost;username=root;password=indusstar;database=mysql");
con.Open();
MySqlDataAdapter da = new MySqlDataAdapter("select * from courses", con);
//need table with primary key
MySqlCommandBuilder cmdBuilder = new MySqlCommandBuilder(da);
DataSet ds = new DataSet();
da.Fill(ds, "courses");
DataRow drow = ds.Tables[0].Rows[3];
//updating
drow[0] = 4;
drow[1] = "Gambas.Net";
drow[2] = 5;
drow[3] = 8000;
da.Update(ds, "courses");
con.Close();
}
}
}
No comments:
Post a Comment