|
List Info
Thread: How can i update my dataSet to SQL Server Databse in c# ???
|
|
| How can i update my dataSet to SQL
Server Databse in c# ??? |

|
2006-04-08 15:04:21 |
|
sorry but didnt understrand this line....
cmdUpdate.CommandText = "UPDATE KULLANICI SET ... <whatever>";
i want to update all columns of active record, can u type the full line please...
thnks...
On 4/8/06, Bradley, Peter <uwic.ac.uk">pbradley uwic.ac.uk> wrote:
Did you set the update command?
(Adapted from Kalani and Kalani):
SqlCommand cmdUpdate =
MyConnection.CreateCommand(); cmdUpdate.CommandType = CommandType.Text; cmdUpdate.CommandText = "UPDATE KULLANICI SET ... <whatever>";
// Sort out any parameters if necessary
MyAdapter.UpdateCommand
= cmdUpdate;
...
You don't have to use a text command, of course. You can also use a stored procedure.
HTH
Peter
-----Original Message----- From: googlegroups.com">
CSDevelopers googlegroups.com on behalf of gmail.com">gndzkdr gmail.com Sent: Sat 4/8/2006 3:01 PM To: C# Developers Cc: Subject: How can i update my dataSet to SQL Server Databse in c# ???
Hi all,
information about database is below database name BAP table name is KULLANICI table columns are ID // primary index K_ADI // varchar
SIFRE // varchar DURUMU // char HES_TURU // varchar
and codes...........
private SqlDataAdapter MyAdapter;
private SqlConnection MyConnection; private DataSet MyDataSet;
private void Form2_Load(object sender, System.EventArgs e) { Form1.oturumac_click=true; MyConnection=new SqlConnection(); MyConnection.ConnectionString
= string.Format("Data Source=;Initial Catalog=BAP;User ID=sa; Password=asdasd;",Form1.server_ip); MyAdapter = new SqlDataAdapter("SELECT * FROM KULLANICI",MyConnection); MyDataSet=new DataSet();
MyAdapter.Fill(MyDataSet,"KULLANICI"); dataView1.Table=MyDataSet.Tables[0]; dataGrid1.DataSource=dataView1; MyConnection.Close();
textBox3.DataBindings.Add("Text",dataView1,"K_ADI");
textBox4.DataBindings.Add("Text",dataView1,"SIFRE"); textBox5.DataBindings.Add("Text",dataView1,"DURUMU"); textBox6.DataBindings.Add("Text",dataView1,"HES_TURU");
}
and i used codes below to update...
CurrencyManager ara =(CurrencyManager)this.BindingContext[dataView1];
/*.............my other codes..............*/
ara.EndCurrentEdit(); MyAdapter.Update
(MyDataSet,"KULLANICI"); MyConnection.Close();
SO WHY IT DOESNT WORK, WHERE I MADE MISTAKE....
THNKS...
| |