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# ???
user name
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...
 
&nbsp;


&nbsp;
On 4/8/06, Bradley, Peter <uwic.ac.uk">pbradleyuwic.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.&nbsp; You can also use a stored procedure.

HTH

Peter

-----Original Message-----
From:&nbsp;  googlegroups.com"> CSDevelopersgooglegroups.com on behalf of gmail.com">gndzkdrgmail.com
Sent: ;  Sat 4/8/2006 3:01 PM
To:&nbsp; &nbsp;  C# Developers
Cc:
Subject: &nbsp; &nbsp; &nbsp;  How can i update my dataSet to SQL Server Databse in c# &nbsp;???


Hi all,

information about database is below
database name  BAP
table name is KULLANICI
table columns are
   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; ID&nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;  // primary index
&nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; K_ADI &nbsp; &nbsp;   ; &nbsp; // varchar
&nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ;SIFRE ; &nbsp; &nbsp; &nbsp; &nbsp; // varchar
&nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp; DURUMU ; &nbsp;  // char
 ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; 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();
&nbsp;  MyConnection.ConnectionString = string.Format("Data
Source=;Initial Catalog=BAP;User ID=sa;
Password=asdasd;",Form1.server_ip);
   MyAdapter = new SqlDataAdapter("SELECT * FROM
KULLANICI",MyConnection);
 &nbsp; MyDataSet=new DataSet();
 &nbsp; MyAdapter.Fill(MyDataSet,"KULLANICI&quot;);
 ;  dataView1.Table=MyDataSet.Tables[0];
   dataGrid1.DataSource=dataView1;
  ; MyConnection.Close();

 &nbsp; textBox3.DataBindings.Add("Text",dataView1,&quot;K_ADI&quot;);
&nbsp;  textBox4.DataBindings.Add("Text",dataView1,&quot;SIFRE&quot;);
&nbsp;  textBox5.DataBindings.Add("Text",dataView1,&quot;DURUMU");
&nbsp;  textBox6.DataBindings.Add("Text",dataView1,&quot;HES_TURU");
}


and i used codes below to update...

CurrencyManager ara =(CurrencyManager)this.BindingContext[dataView1];

/*.............my other codes..............*/

ara.EndCurrentEdit();
MyAdapter.Update (MyDataSet,&quot;KULLANICI");
MyConnection.Close();


SO WHY IT DOESNT WORK, WHERE I MADE MISTAKE....

THNKS...









--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "C# Developers" group.
To post to this group, send email to CSDevelopersgooglegroups.com
To unsubscribe from this group, send email to CSDevelopers-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/CSDevelopers
-~----------~----~----~----~------~----~------~--~---

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )