I am having trouble inserting data into the table using dataset..following is my code:
The m_id is a primary key..I want to auto-increament it everytime a data is inserted into the table so I have configured (isIdentity) to Yes and Identity increament to "YES"..I don't know if its right or not..I already added some data manually into the table but now I want to add more data using the above code..but its not working..
I have two tables cust and order_cust cust table have cust_id, name, addr, zip columns and order_cust have order_id and cust_id columns I take input from user for cust table i.e. name, addr, zip... the cust_id is an IDENTITY column so generates the value automatically Now I want to insert the last generated cust_id into order_cust (order_id is also an IDENTITY column)
I am doing a management system . What i am trying to accomplish is that when a user fill form relevant to management system the data should go into respective tables.How to accomplish this.I am using primary keys and foreign keys
I m getting following error in my eventvwr . I couldnt find reasons of the following error.
"Transaction (Process ID 110) was deadlocked on lock | communication buffer resources with another process and has been chosen as the deadlock victim. Rerun the transaction. "
The only thing my page is doing is inserting/updating data into a table in sql and the thing I can think of is because multiple users are using the same page to insert/update data? Will that cause deadlock?
In short, I have 3 text box fields on an .aspx page named as follows:-
TextBoxIncident TextBoxDate TextBoxDescription
in addition a sql datasource is on the page which is connected to the incident table with an insert query which allows the data entered into the fields to be inserted into the database...
The Textboxincident and textboxdescription fields allow the user to enter data into them...
the TextBoxDate field is a read only and the code behind file enables the text box to show the current date and time the code im using is shown below...
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim TextBoxDate As TextBox TextBoxDate = FormView1.FindControl("TextBoxDate") TextBoxDate.Text = DateTime.Now End Sub
When run in browser the textboxdate field shows the current date and time...and Once the textbox incident and text box description fields have been filled in and the submit button is clicked, the fields should be bound to MS SQL table called Incident. This did work before, however it as suddenly stopped working and now displays the following message to me:-
Arithmetic overflow error converting expression to data type datetime. The statement has been terminated.
My dataset table data is from multiple tables (showing on a gridview),How to update the database tables using batch udpate on clicking submit, if the data is from a signle table, no problem, but I am not sure how to handle if the datais from mulitiple tables? If I have related tables, do I need put them in differet tables in the dataset?
I'm returning one table. My understanding is that a DataSet can be made of more than one DataTable. I also understand that I can use either of these to return my one table.
Is it better to use the DataTable when I have one table to return instead of a DataSet? Is there any advantage of not using the DataSet in a situation like this? Is there a disadvantage to using the DataSet when only one table is being returned? Does this even matter?
I am working on a web app for an online photo album. It is the last project in Scott Mitchell's book: "ASP.Net 2.0 in 24 hours".
I am creating a page where users can enter new photo images. The functionality for uploading an image will come later. I am working on just inserting a new row into the Pictures table with an optional category, a required title and a required description.
I am getting an error when I try to insert a new row.
Here is a screenshot of the page with a shot of the dropdown list.
The Categories are user-specific. I am getting the correct values retrieved.
There are two pretty simple database tables involved here.
NOTE: The CategoryID and PIctureID are both autoincrement integer columns.
The page uses a DetailsView that uses a SqlDataSource that uses the Pictures table. (The DetailsView's Default Mode property is set to "Insert". The "Enable Inserting" checkbox is also checked.)
The dropdown list uses a dropdown control that uses a SqlDataSource that uses the Categories table.
When the "Insert" button is clicked the CategoryID value associated with selected (Category) Name on the dropdown list will be used along with the Title and Description values to insert a row in to the Pictures table. (If no Category value is selected, then a null value will be used for the CategoryID. This is OK because the CategoryID column in the Pictures table allows nulls.)
My problem is that I am getting this error:
Cannot insert explicit value for identity column in table 'Pictures' when IDENTITY_INSERT is set to OFF.
(FYI: I have the full version of both Visual Studio and SQL Server.)
The functionality I want to achieve is that when isHomePageFeatured is checked then this record is set to 1 for that column and for all the other records in the table it is set to 0.
This is fine for update as I can use the property Id to compare against, but for the newly inserted record it doesn't yet have a propertyId so I wondered if using newID() to affect all other records would have the same affect.
I have an SQL datasource that successfully enters customer details into a table. What it includes is the persons address. First of all we add the persons address, then we add the persons name to that address in a seperate physical procedure. i.e. on a different form.
What I need to do is try and stop users entering the same address twice. The way I have thought of doing this is by making a string field called AddressIdentity and have this contain the door number and the postcode of the address with all the spaces stripped out. Then when adding the address, it checks if this exists before adding it. However I cannot work out how to put the 2 fields together without using the codebehind file, which I don't mind doing if I need to, but I'm sure its avoidable.
Here is my code - I have only included the relevant parts: