G
Guest
Hi Everybody,
I'd Appreciate anybody who can give me a lead here.
I'm trying to run an "Insert" command from my ASP page. The command takes as
values some on-page textboxes as well some other paremeters such as user info
etc.
I tried using a DataSet method, but could not figure out how to insert
custom parameters (the user info ones), so i switched to inline SQL this is
my code:
Dim dtsRequest As New SqlDataSource
dtsRequest.ConnectionString =
ConfigurationManager.ConnectionStrings("IODatabaseConnectionString1").ToString
dtsRequest.InsertCommandType = SqlDataSourceCommandType.Text
dtsRequest.InsertCommand = "insert into requests (requestedby,
checkdate,CheckAmountNIS,payeename,shortdescription,notes,autoconfirm,rate)
values (@requestedby, @checkdate,
@CheckAmountNIS,@payeename,@shortdescription,@notes,@autoconfirm,@rate);
select @@identity"
dtsRequest.InsertParameters.Add("RequestedBy", curPersonID)
dtsRequest.InsertParameters.Add("CheckDate", CheckDateTextBox.Text)
dtsRequest.InsertParameters.Add("CheckAmountNIS",
CheckAmountNISTextBox.Text)
dtsRequest.InsertParameters.Add("payeename", PayeeNameTextBox.Text)
dtsRequest.InsertParameters.Add("shortdescription",
ShortDescriptionTextBox.Text)
dtsRequest.InsertParameters.Add("notes", NotesTextBox.Text)
dtsRequest.InsertParameters.Add("autoconfirm",
AutoConfirmCheckBox.Checked)
dtsRequest.InsertParameters.Add("rate", RateTextBox.Text)
'Now I dimension an integer and set it to the DataSource's Insert Method:
Dim inNewRequestID As Integer
inNewRequestID = dtsRequest.Insert
'---------END CODE
Now I wanted that the inNewRequestID should be the identity field. isn't
that what it is supposed to return? now it returns "1" as number of affected
rows, which is not what I need.
Any lead would be appreciated. I'm after a whole night of Googling on this
one <yawn>.
I'd Appreciate anybody who can give me a lead here.
I'm trying to run an "Insert" command from my ASP page. The command takes as
values some on-page textboxes as well some other paremeters such as user info
etc.
I tried using a DataSet method, but could not figure out how to insert
custom parameters (the user info ones), so i switched to inline SQL this is
my code:
Dim dtsRequest As New SqlDataSource
dtsRequest.ConnectionString =
ConfigurationManager.ConnectionStrings("IODatabaseConnectionString1").ToString
dtsRequest.InsertCommandType = SqlDataSourceCommandType.Text
dtsRequest.InsertCommand = "insert into requests (requestedby,
checkdate,CheckAmountNIS,payeename,shortdescription,notes,autoconfirm,rate)
values (@requestedby, @checkdate,
@CheckAmountNIS,@payeename,@shortdescription,@notes,@autoconfirm,@rate);
select @@identity"
dtsRequest.InsertParameters.Add("RequestedBy", curPersonID)
dtsRequest.InsertParameters.Add("CheckDate", CheckDateTextBox.Text)
dtsRequest.InsertParameters.Add("CheckAmountNIS",
CheckAmountNISTextBox.Text)
dtsRequest.InsertParameters.Add("payeename", PayeeNameTextBox.Text)
dtsRequest.InsertParameters.Add("shortdescription",
ShortDescriptionTextBox.Text)
dtsRequest.InsertParameters.Add("notes", NotesTextBox.Text)
dtsRequest.InsertParameters.Add("autoconfirm",
AutoConfirmCheckBox.Checked)
dtsRequest.InsertParameters.Add("rate", RateTextBox.Text)
'Now I dimension an integer and set it to the DataSource's Insert Method:
Dim inNewRequestID As Integer
inNewRequestID = dtsRequest.Insert
'---------END CODE
Now I wanted that the inNewRequestID should be the identity field. isn't
that what it is supposed to return? now it returns "1" as number of affected
rows, which is not what I need.
Any lead would be appreciated. I'm after a whole night of Googling on this
one <yawn>.