title image


Smiley Re: Code Schnipsel für DB Connect
System.Data.SqlClient.SqlConnection sqlConnection1;

System.Data.SqlClient.SqlDataReader dr;

System.Data.SqlClient.SqlCommand command1;



sqlConnection1 = new System.Data.SqlClient.SqlConnection();





this.sqlConnection1.ConnectionString =

@"Data Source=SERVERNAME\BENUTZER;initial catalog=Datenbankname;password=PASSWORT;persist security info=True;user id=sa;workstation id=SERVERNAME;packet size=4096";



sqlConnection1.Open();



command1 = sqlConnection1.CreateCommand();



command1.CommandText = "select * from tabellexyz";



dr = command1.ExecuteReader();



while(dr.Read())

{

string test = dr["Feldname"].ToString();



}



dr.Close();

-----------------------------------------------------------------------



oder

------------------------------------------------------------------------

command1.CommandText = "UPDATE tabellexyz set fk_status = 1 where bla = 123" ;



bool isOK= (command1.ExecuteNonQuery()>0);



geschrieben von

Login

E-Mail:
  

Passwort:
  

Beitrag anfügen

Symbol:
 
 
 
 
 
 
 
 
 
 
 
 
 

Überschrift: