I am using Visual studio 2010 express and I have a details view databinded to an sql database table. When I use the Insert option on the view it causes an error due to it trying to insert a null into the primary key field. If the Insert function does not create a new primary key entry how is it created?
I have a details view form inserting data into one table successfully with no problems and picking up the ID parameter from a session.
What i would like to do is one insert SOME of the fields NOT ALL get inserted into another table.
Table 1 = course
table 2 = matrixoneantwo
I tried creating a datasource which inserted data into Matrixoneanttwo and called it from the detailsview_inserting event (sqldatasource.insert() but then i realised that this data source is seperate to my current one and therefore cannot use its parameters.
I have a sproc that will insert a new record into Table1. Next I need to Insert into another table the scope_identity of the inserted record. How do I incorporate the scope_identity value as the insert parameter in the second insert statement?
I've got a TextBox to capture the value of "Name" in Table A.
Ive got a CheckBoxList that displays all the pre-determined values of Table B.
When the user selects an item from the CheckBoxList i want to populate Table C with the value of the selected item from the CheckBoxList and the cooresponding ID associated with the user name for that person's entry.
i have a form view that takes fields from two tables 'Contract' and 'volunteers', however because i used a query builder,i have to input an insert statement. How do i create an insert statement for two tables in one query?
.NET newbie. I know there has to be a way to do this.I have a details view with it's default mode set to Insert. This is to be used as a form for users to enter records into a database. For two of the fields, I want to pre-populate the field with information. Specifically, I have a vb script with a few functions to query Active Directory to return the user's name based upon their user id. This script works fine.I call the functions for the user name like this:
When the page loads, this populates the text boxes with the user id and the user name.But when the form is submitted, the values in the text boxes are not inserted in to the database.How can I set default values for the fields when the values come from functions?
I have a insert into statement thats inserting my numbers from a numeric text box on my aspx page. I am choosing the Amount Type then putting in a a number.
So i have a drop down that i select example Direct Charge then i enter 600.00 and click add it puts that in to the databse for me woot..
I then put in say Misc Credit and enter 200.00 it inserts in that into the database woot.
The look up table that has my amount types has a field called numeric opperator which is either + or - the Credit being a - and the Charge being a + then my stored procedure takes all my + numbers and adds them up and subtracts all the - numbers.
I want to change that so that it actuall be inserted into the table as a - number form the start. So I want choose Misc Credit enter 200.00 and click add then my event says o yea thats a credit insert 200.00 as -200.00
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 am using 1 textbox with a Ajax Calendar extender to allow my user's to select a date graphically (exp: 12/15/2009). I have another textbox for the hour and minutes in military time(exp: 15:30). I think i have the code to grab the data from the 2 textbox's and combine them to be inserted into the field (exp: 12/15/2009 15:30). Here is my insert code for the Field:
However unless I make all the fields Nullable the insert fails, on top of that none of the other field that I have selected on the Detailsview Insert or Edit are inserted into there fields. Half of my fields have to be non-null values. So how do I fix this?
I can supply additional vb code and the aspx code if needed.
This is the error I'm getting: Cannot insert the value NULL into column 'Operation_type', table '/GAOSDB.MDF.dbo.BC_Perf_Log'; column does not allow nulls. INSERT fails. The statement has been terminated.'
This is the first non-null column.
I need to get this figured out because I have 30 other web pages that will be utilizing the same approach.
Conseptually what I'm doing is simple, and technically it may even be simple, but I'm still rusty. Here's what I'm trying to do:
I have a webform that allows the user to enter a new record, and in there I have also included a couple FileUpload controls. Upon clicking the "Save" button, I'm saving the details entered into one table (ITEMS), and also inserting the FileUpload details (path, id, upload_user) into another table ATTACHMNTS). Because one ITEM can have many attachments, I needed to split the tables up. So on save, I need to save the ITEM, save the ATTACHMENT, and then also put the ITEM_ID in the ATTACHMENT table. I'm second guessing myself because I think all I'd have to do is after I do the ITEM insert, do a SELECT MAX on the ITEM table and hold the newest (MAX) id in a variable and then use it in the ATTACHMENTS update. I'm not 100% on this because there IS a chance that someone else could save a few milliseconds later and I'll link the wrong ITEM. See my delima?
I have a project that I was using Access for but now find I have to change to SQL Express. Well I have no big problem with that but I now find that the SQL Statement I have been using was for OLE and does not work in SQL/Express. I am not even sure anymore if I can dump the entire CSV file in at one time? The statement I was using is below.
Here is my problem. What is the INSERT statement to insert a complete flat (CSV) into SQL Express? OR what method can I use to preform this task?
I'm very new on VWD, but I got the hang of it for the past 2 weeks(thank you for all the videos posted here in ASP.NET),but I'm really weak on the coding part(vb & c#),except for all the sample shown on the tutorials. Anyways, I have a simple project that does insert, update & delete to SQL express using the details view. But to complete my project, I need to add a button that will create an event to restore the very last record inserted in SQL and display it back into the details view for minor modification and nserted again as the newest record with the mod. I'm doing this so user, doesn't need to re-key-in redundant information, like names, original date & time etc, and just make modification on the description of the last record.....
i have to make this form in my asp.net project [URL] so a tipical master/detail relation in the top of the form there a datepicker wich correspond to master table+ other controls like the customer the grid corespond to the details table (order details table) i want to add records to the details table in the client side and then send all the records in one operation to the server - the problem is how to get the correct primary key from the master table ? - how to insert details record in the client using a gridview control
I use GridView & FormView to update a record. but when I click the "save" button, throw an except : FormView must be in the insert mode to insert a record. The record has been updated success, and I didn't change the mode of the FormView, how this error comes?
In my detailsview, I have an emptydatatemplate set up to allow users to enter new records. The code works. However, once the record is inserted, the detailsview defaults to a standard insert screen. I know this will cause confusion for the users. I would prefer the detailsview to either show in edit mode or a read-only mode. I have used detailsview.changemode and detailsview.currentmode in the custom sub created for the add new button of the emptydatatemplate- neither of which do what I was hoping. It would be even better if when there was no data, it defaulted to the insert screen (which seems like that should be an easy, no-brainer way for .net to function) but it doesn't. Or, I don't know how to accomplish it.
I don't want to force the user to click cancel after inserting an item through the emptydatatemplate just to be able to use the detailsview for other records.