473,503 Members | 2,082 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Insert in two tables

30 New Member
Hi, i Write in two table (HelpDesk nad HelpDesk2) + use Stored Procedure(InsertHelpDesk and InsertHelpDesk2)

In first table (HelpDesk) don't insert record. Why?

in second (HelpDesk2) all ok. All record insert.

//--------Write to firs table, HelpDesk

SqlConnection conn;
SqlCommand comm;

string connectionString = ConfigurationManager.ConnectionStrings[
"Dorknozzle"].ConnectionString;
// Initialize connection
conn = new SqlConnection(connectionString);
// Create command
comm = new SqlCommand("InsertHelpDesk", conn);
// Specify we're calling a stored procedure
comm.CommandType = System.Data.CommandType.StoredProcedure;
// Add command parameters
comm.Parameters.Add("@EmployeeID", System.Data.SqlDbType.Int);
comm.Parameters["@EmployeeID"].Value = 99999990;

comm.Parameters.Add("@StationNumber", System.Data.SqlDbType.Int);
comm.Parameters["@StationNumber"].Value = "9999990";

comm.Parameters.Add("@CategoryID", System.Data.SqlDbType.Int);
comm.Parameters["@CategoryID"].Value = "99999990";

comm.Parameters.Add("@Description", System.Data.SqlDbType.Int);
comm.Parameters["@Description"].Value = "9999999990";

//--------Write to second table, HelpDesk2
comm = new SqlCommand("InsertHelpDesk2", conn);
// Specify we're calling a stored procedure
comm.CommandType = System.Data.CommandType.StoredProcedure;
// Add command parameters
comm.Parameters.Add("@StatusID", System.Data.SqlDbType.Int);
comm.Parameters["@StatusID"].Value = 999990;

comm.Parameters.Add("@SubjectID", System.Data.SqlDbType.Int);
comm.Parameters["@SubjectID"].Value = "99999990";

..........
Jul 28 '08 #1
1 1294
r035198x
13,262 MVP
At which points are you calling the ExecuteNonQuery() (or similar) for the updates to take place?
Jul 29 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
4677
by: EricRobineau | last post by:
hello I have a DB with many inter-related tables (MySQL) My main table called "content" has almost only foreign keys (integers) some have a 3 level relation (ex: content->city->region->country) ...
14
4269
by: serge | last post by:
I have a scenario where two tables are in a One-to-Many relationship and I need to move the data from the Many table to the One table so that it becomes a One-to-One relationship. I need to...
16
16975
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums...
16
3844
by: robert | last post by:
been ruminating on the question (mostly in a 390/v7 context) of whether, and if so when, a row update becomes an insert/delete. i assume that there is a threshold on the number of columns of the...
6
10619
by: Larry Johnson | last post by:
I have two similar SQL Server databases each with a table named Payments. PaymentID is an identity field and the primary, unique, key in both tables. There is one other key but it is not unique. ...
8
6274
by: Carl | last post by:
Hi, I hope someone can share some of their professional advice and help me out with my embarissing problem concerning an Access INSERT query. I have never attempted to create a table with...
2
2798
by: RSH | last post by:
I have a rather simple script that transfers data from a SQL server database to an Access database. The procedure is intended to be dynamic so I am basically adding a datarow and then passing the...
8
3486
by: nano2k | last post by:
Hi Shortly, I keep invoices in a table. Occasionally, someone will fire the execution of a stored procedure (SP) that performs several UPDATEs against (potentially) all invoices OLDER than a...
3
7974
by: nolanmadson | last post by:
I'm creating a front-end for some Teradata user maintenance tables in MS Access. I've started having problems in occasionally not being able to insert or update records in these tables. I've been...
0
4434
chumlyumly
by: chumlyumly | last post by:
Hello scripters - OS: Mac OSX Language: PHP w/ MySQL database I've created an insert page where a user inputs his info, which then goes to four different tables in a MySQL database. The...
0
7353
jinu1996
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...
0
5596
agi2029
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,...
1
5023
isladogs
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...
0
4689
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3180
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...
0
3170
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1521
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 ...
1
747
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
401
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.