please correct for me the syntax

Discussion in 'Meet and Greet' started by ahmad zrein, Oct 22, 2011.

  1. ahmad zrein

    ahmad zrein New Member

    Joined:
    Sep 15, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    director
    i want to transfer variables into the table, i am new in the c#


    System.Data.SqlClient.SqlConnection conn = null;
    conn = new System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings["Database1ConnectionString"].ConnectionString);
    conn.Open();

    System.Data.SqlClient.SqlCommand insertCommand = new System.Data.SqlClient.SqlCommand
    ("Insert into [Transfer] (ntransferID, nreference, cbranch, cfrom_tel, cfrom_name, cfrom_mother, cfrom_address, cto_name, cto_address, cto_tel, ccur;) Values (4, 2, @icbranch, @icfrom_tel, @icfrom_name, @icfrom_mother, @icfrom_address, @icto_name, @icto_address, @icto_tel, @iccur;)", conn);

    insertCommand.Parameters.Add("@icbranch", lcbranch);
    insertCommand.Parameters.Add("@icfrom_tel", lcfrom_tel);
    ....
    insertCommand.ExecuteNonQuery();

    i use the code in the c# help

    thanks

    ahmad zrein
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice