i need to insert multiple rows at a time into database table(sqlserver) from datatable or gridview. Actually iam looping through the rows of gridview and inserting each row. Is there any method to insert entire table of rows at a time into database table. Both datatable columns and database table coulmns are similar.
Single record in Customer can have multiple CustomerPhone records. As you see in the image below, Phone and Fax resides in CustomerPhone table whereas the rest of the fields resides in Customer table. If user want to edits a customer record, obviously i will have to update the record in Customer table and at least two records from CustomerPhone (Phone and Fax).
I could write two update statements, one Update customerPhone and the second update Customer table. Is there a better solution?
I have two tables.One is registeration table in which we have city,state,country and another is location details table in which we have city(multiple values seperated by commas),state and country also same as city
I want to generate 30,000 cards and each card must be duplicate check with database. In my card, there are 2 things. Serial No and CardID. If any card already exists then I generate another card id but with the same serial no.
So how faster way I can generate 30,000 card with duplicate check? Which one I have made application, it takes about 25 minutes to insert.
I have a Winform that has fields need to be filled by a user. All the fields doesn't belong to one table, the data will go to Customer table and CustomerPhone table, so i decided to do multiple inserts. I will insert appropriate data to CustomerPhone first then Insert the rest data to Customer table.
I need to update bulk values (more than 20000 each time) from my web form into sql server 2005 .I have a web page , from which when i click submitt button values from the form should be inserted . For that i tried normal method as shown below
But this is also slow (Adding to datatable make its slow I suppose ) .Is there any other method so that my insertion can be made faster .
query if @lo=1, i am inserting all of the child records for the corresponding 'InsurID' into 'tbLocal' table. I used to store it individualy if it has two child records by using cursor.But i could not insert the values into tbLocal table.
I'm trying to execute a simple insert statement with the GUID and timestamp populated by default from the server. I have both of their default values set as (newid()) and (getutcdate()) respectively in SQL server. However, I receive the error when I try and execute the command "Insert Error: column name or number of supplied values does not match table definition". How do I construct my sql insert so my id and timestamp columns use their default values as assigned in sql server?
Using sql server and trying to insert decimal values using a ASP.NET C# code. I get the value for hours from a text box through user input and I'm trying to insert it to the database.
strSQLWAUpdate = " UPDATE Project SET WAHours='" + txtWAHours.Text + "' WHERE WAProjectID='" + hidWAProjectID.Value + "' ";
What happens is it rounds off the hours to interger value. So if I insert 22.3 in the text box what i get in the database is 22 and if I insert 22.7 I get 23 in the database. I do not need any rounding but need to get the values as it is. ( that is 22.3 and 22.7 respectively)
I have one SP in sql server which takes the data from user and inserts into three tables. My problem is if multiple users call the same SP in same time it throwing error..(I guess one user at a time can access the table and table will be locked, that is why remaning users getting error)how to handle this situation. it is a web application, so at a time so many people can call the same SP.How can many users insert data in the same table in the same time?
I'm having a gridview in my aspx page with checkbox, User can select one or more than one record(s) at a time and clicks on delete button, Then i'm constructing an object of my DTO and adding all the checked row's Primary Key (DataKeyNames - GUID's in case) to a serializable class and generating an XML and sending it as parameter to the Stored Procedure.
My Doubt is, can i bulk delete all the rows from database table those are present in my XML document??
If it works, I can do bulk update with XML only, i already did bulk insertion by generating an XML..
My Another Question is, Will it affect the performance? Each time when i construct an DTO object and adding it to the Generic List??
WHich one is better, I mean ObjectDataSource or SQLDataSource or my XML method?