insert into SQL using asp

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • b00gieman
    New Member
    • Jul 2007
    • 13

    insert into SQL using asp

    Hi!
    I'm newb to Ms SQL.I have to do an application that reads data from an user and puts the data into a database.I have to do multiple inserts (from the data given by the users).I'm gathering all data submitted by an user into an string(text6)(f or example,all the data a user puts into a field is stored into this variable).The words in the string are separated by ",".I have several strings like this one.
    I'm trying to do a multiple insert,similar to this:

    var i=0;
    SQLstr="Insert into dbo.Database (uid,Object,Typ e) values";
    if(i == text6.length)
    Sqlstr+="('"+te xt1+"','"+text6[i]+"','"+text7[i]+"')";
    ***here is a command that will execute SQLstr****
    else
    {
    for(i=0;i<text6 .length;i++)
    Sqlstr+="('"+te xt1+"','"+text6[i]+"','"+text7[i]+"'),";
    Sqlstr+="('"+te xt1+"','"+text6[i]+"','"+text7[i]+"')";
    ***command that will execute SQLstr***
    }

    My problem is :
    if given a single field(containin g uid,Object,Type ),the insert is executed well.If given multiple fields , only one insert is made.Any suggestions are welcome!
Working...