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)(for 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,Type) values";
if(i == text6.length)
Sqlstr+="('"+text1+"','"+text6[i]+"','"+text7[i]+"')";
***here is a command that will execute SQLstr****
else
{
for(i=0;i<text6.length;i++)
Sqlstr+="('"+text1+"','"+text6[i]+"','"+text7[i]+"'),";
Sqlstr+="('"+text1+"','"+text6[i]+"','"+text7[i]+"')";
***command that will execute SQLstr***
}
My problem is :
if given a single field(containing uid,Object,Type),the insert is executed well.If given multiple fields , only one insert is made.Any suggestions are welcome!