I'm working with ASP.Net on IIS 5.1 and MSSQL 2000 and have a rather
frustrating problem. I'm trying to insert a record to a table, get the
identity value, and insert two additional records to a second table.
My insert command looks like this:
INSERT INTO TableA VALUES(PK_NameI D, CQ1, CQ2, CQ3, CQ4);
DECLARE @ID int;
SET @ID = SCOPE_IDENTITY( );
INSERT INTO TableB VALUES(@ID, IQ1, IQ2, IQ3, IQ4);
INSERT INTO TableB VALUES(@ID, IQ1, IQ2, IQ3, IQ4);
The insert command is all mashed together in the InsertCommand
parameter of a SqlDataSource. When I run the query by hand in sqlcmd,
everything works beautifully, but when I try to run it on the page,
only the first insert command is processed. I can't find any
information in any of the logs or anywhere on Google to suggest what is
going wrong. Any help is greatly appreciated.
Thanks,
-Sean 1 2251
Try putting the command in a stored procedure and use the stored
procedure in your SQLDataSource.
ssims wrote:
I'm working with ASP.Net on IIS 5.1 and MSSQL 2000 and have a rather
frustrating problem. I'm trying to insert a record to a table, get the
identity value, and insert two additional records to a second table.
My insert command looks like this:
INSERT INTO TableA VALUES(PK_NameI D, CQ1, CQ2, CQ3, CQ4);
DECLARE @ID int;
SET @ID = SCOPE_IDENTITY( );
INSERT INTO TableB VALUES(@ID, IQ1, IQ2, IQ3, IQ4);
INSERT INTO TableB VALUES(@ID, IQ1, IQ2, IQ3, IQ4);
The insert command is all mashed together in the InsertCommand
parameter of a SqlDataSource. When I run the query by hand in sqlcmd,
everything works beautifully, but when I try to run it on the page,
only the first insert command is processed. I can't find any
information in any of the logs or anywhere on Google to suggest what is
going wrong. Any help is greatly appreciated.
Thanks,
-Sean
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Mike Kelly |
last post by:
I've chosen to implement the "optimistic concurrency" model in my
application. To assist in that, I've added a ROWVERSION (TIMESTAMP) column to
my main tables. I read the value of the column in my select, remember it, and
then use it in the update. It works just fine when I have full control of the
whole process.
I want to do the same for...
|
by: Wayne Wengert |
last post by:
Using VSNET2005. I want to insert some rows into a table. Each row has 2
columns, "memberid" which is a GUID and "Interests" which is a varchar. I
created a SQLDataSource with the values to insert as parameters as shown
here
=====================================================
<asp:SqlDataSource ID="SqlDataSource2" runat="server"...
|
by: Ned Balzer |
last post by:
I'm trying to create a formview bound to a sqldatasource, and use a
stored procedure to insert data from the formview into several tables.
I have some simplified code below, the real code is much longer but
this should illustrate the problem:
<asp:FormView ID="bookFormView" runat="server"
DataSourceID="bookSqlDataSource">
<ItemTemplate>...
|
by: tom c |
last post by:
I am using Visual Web Developer 2005 Express Edition. I created a
SQLDataSource just by draging the control to the form and filling in
the blanks in the wizard.
In code I need to use the SQLDataSource to load data from several
tables into datasets or datatables, work with the data, then insert new
rows into tables in the SQL Server...
|
by: JR |
last post by:
I have a question with SqlDataSource controls. I have a SqlDataSource
control that has a select, insert and update parameters defined. This
is running with Visual Studio 2005 Team system and Net Framework 2.0.
My problem is I want to get the last generated Identity field from a
table =IDENT_current('tblname')=. I can put this command in...
| |
by: djc |
last post by:
1) I am wondering if I should be using an sqlDataSource object for my
particular scenario. I need to loop through a listbox and perform an INSERT
sql operation for each item. Could be a few or several items. The reason I'm
wondering if I should use an SqlDataSource object is overhead. For example,
prior to learning about the sqlDataSource I...
|
by: sheenaa |
last post by:
Hello Members,
I m creating my application forms in ASP.Net 2005 C# using the backend SQL Server 2005.
What i have used on forms :: ?
On my first form i have used some label,textboxs,dropdownlists,radiobutton and checkbox asp standard controls.
On the click event of the command button the data gets stored into the...
|
by: Joe Kovac |
last post by:
Hi!
The informations of our customers are saved in two tables:
Customer: ID, CustomerNumber, ... + Person_ID
Person: ID, Name, ...
I want to have an editable GridView displaying all the data and being
able to add, edit and delete customers.
|
by: dhyder |
last post by:
I'm working on an admin page for a SQL Server 05 db. The page is in ASP.NET 2.0/C#. The db has multiple tables with foreign keys/constraints.
I have multiple SqlDataSources and GridViews, which are doing the select/update/delete methods. I manually did the Insert method for each Gridview and I am able perform error handling on it.
...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |