Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[help c#] add collumn auto increment id
15-05-2012, 09:25 AM, (This post was last modified: 15-05-2012, 09:26 AM by kayman120.)
Post: #1
[help c#] add collumn auto increment id
Code:
MySqlConnection connection = new MySqlConnection(ConnectionString);
MySqlAdapter data = new MySqlDataAdapter();
MySqlCommand command = connection.CreateCommand();
command.CommandText = "select * from pelanggan";
data.SelectCommand = command;
connection.Open();


DataSet ds = new DataSet();
data.Fill(ds, "pelanggan");
dataGrid1.ItemSource = ds.Tables["pelanggan"].DefaultView;

atas nih code yg aku buat untuk retrieve semua data dlm table "pelanggan" ke dalam datagrid.. and dlm table tuh aku tak bubuh collumn untuk ID...so, aku nak insert 1 collumn ID dekat datagrid yg tak relate dengan database. collumn ID tu macam Bilangan row la..ok..harap dapat membantu...
Kalau tiada angin masakan pokok bergoyang
Reply


Forum Jump: