#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Posts
    3
    Rep Power
    0

    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. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Posts
    3
    Rep Power
    0
    forgot to paste the error I get

    error: system.data.sqlclient.sqlexception while writhing to database.


    Regards
    Volfram
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Posts
    3
    Rep Power
    0
    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

IMN logo majestic logo threadwatch logo seochat tools logo