|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Problem making a Insert
Hi everyone
I have a problem I have been wondering about some time now ... Im making a simpel convert program that takes a '\t' or ';' delimited text, chopps it up and entere it undre the right field in a windows 2000 sql server. First I wonderd it the sql strings had a syntax fault, but then I tryed to execute them in excel (get external data -> starts microsoft querry ) on the same machine , and it works fine. So I then suspected that fore some reason i didnt have the same rihgts in my .NET enviroment as I had in microsoft querry... strange. public void test() { try { SqlConnection Conn = new SqlConnection("user id=USER; password=PASSW; initial catalog=db_test; integrated security=SSPI;persist security info=False;server=SERVER1;workstation id=XXXXX-volfram;packet size=4096;"); try { con.Open(); statusBar.Text="Sucessfully conected to Jeeves"; } catch(Exception e) { statusBar.Text="ERROR -> NOT CONECTED TO JEEVES:\t"+ e.GetType(); } SqlCommand command = new SqlCommand(); // @@ this one works @@ //command.CommandText = "select artnr from op"; // @@ This one donīt work @@ command.CommandText = "insert into OP (artnr,opnr,opben,prodGr) values ('10002',13,'CadLIsta',0)"; command.Connection=Conn; command.ExecuteNonQuery(); statusBar.Text="Inside test Function"; Conn.Close(); } catch(Exception e) { statusBar.Text="\r\n Error: " + e.GetType() + " While writhing to database"; textBox1.Text +="\r\n Error: " + e.GetType() + " While writhing to database"; } } |
|
#2
|
|||
|
|||
|
forgot to paste the error I get
error: system.data.sqlclient.sqlexception while writhing to database. Regards Volfram |
|
#3
|
|||
|
|||
|
AHHH DAMIT ....sorry .... got it
string myConnString ="user id=USER; password=PASSW; initial catalog=db_test; integrated security=SSPI;persist security info=False;server=SERVER1;workstation id=XXXXX-Voflram;packet size=4096"; If I removed integrated security=SSPI it worked Have a nice day Volfram |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > .Net Development > Problem making a Insert |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|