I have a table with casenum as primary number and Identity column turned on. I know that the casenum will only auto-generated after a record is written into a table.
The front end to this table is a FormView on an AJAX webform.
Table is linked to the webform via LinqDataSource.
Now, on the webform, how can I display nextval before the record is actually written into a table?
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:
but of course AddressIdentity is a string. Do I use ' ' marks with an & sign? Or can't I do this?? Maybe I need to use the codebehind anyway to see if the field exists before inserting it?
I creating a real Estate web application. I have a form where the admin can type price for a specific property. The price will be insert into the SQL database.
Which is the best SQl data type to store for example : £150.000 and then retrieve it from the database. It has to be any type of SQL data that store number as I have a search on the website that compare values of numbers. It cannot be for example varchar othewise I will get an error.
I have a textbox which the user writes a word into. They then press a button to add that word to a list which is stored in the database.
What is the code to do add their word to the database? Do I need code on the main aspx file or only on the code behind?
What I tried doing up until this point is that once the button is pressed, in the codebehind the following happens:
[Code]....
I get errors telling me that the column name Program is invalid (I have a table named Program with one column named ProgramName)
I looked at a bunch of tutorials but nothing is straight forward and simple, it keeps confusing me. I need the simple step by step instruction to do this. I'm using a SQL database and coding in VB
i am trying to display a pop up message box on inserting the data into the database. The code i am using is as follows..
[Code]....
The problem is even on inserting the data and the data getting inserted into the database, the pop up mwindow does not get displayed. On debugging, it shows the value of i as 0.
This is the first time I have been working on databases and I am trying to insert data using an object datasource but no data is being inserted and no exception is thrown. I'm not sure where I am going to wrong. I am putting user data into session variables and inserting the session variables into the dataacess class layer and have a try and exception but nothing being thrown. Any help would be really appreciated because I don't know even where to start looking with this or how I can get the error to be thrown. Please see some of my code below to give an idea of what I am doing
Object Access Class public void InsertCarPolicyHolder(PolicyHolderClass ph, CarInsuranceOptions options) {
I have a formview that is working fine for with the exception of the username is not inserting on a new record. The username is visible on login so I know that is working. I'm attaching my sql code as well as the code behind as I don't know what I'm missing.
I need to insert a Boolean value into an SQL Server datatable. I'm having a problem with what I'm trying. I don't see the option for a Boolean data type in SQL Server so I used Binary(1). Is this the right data type for storing Boolean in SQL Server?
What is the best method in T-SQL 2008 for extending a table's records with the criteria of 'repeating' all fields but the Primary KEY e.g. Consecutive Date for the previous n Records.
So you have for example 7 records (Easy...2 Fields. Date and nvarchar) with th Date runing from Jan-01 to Jan-07
We want to extend the table by 21 records...so
Record 1,8,15,22 will look identical apart from the DateField.
Record 2,9,16,23 will look identical apart from the DateField. etc...etc..
I have tried a number of methods ...all coming up short....
Based on the scheduled meeting, read all users from table #1 and add their info in the table # 3 with the MeetingID (which I can get from the UI, because it will happen when they create the meeting).
I have been browsing about it, but so far, I couldn't find a good source of info to start with.
Im trying to get the ID out of the record that i'm inserting using scope_identity. I've add the following line of code to the Insert statements in the sqldatasource - SET @insID = Scope_Identity() I've add the following line to the Insert parameter list
I now want to insert a number records into the database using the following:
Dim insID As Object = e.Command.Parameters("@insID").Value ' gets out latest ID Dim ordernumber As String = "CX" & insID.ToString & DateTime.Now.DayOfYear.ToString sqlOrders.InsertParameters("orderNumber").DefaultValue = ordernumber sqlOrders.InsertParameters("orderDate").DefaultValue = DateTime.Now sqlOrders.InsertParameters("customerID").DefaultValue = userID sqlOrders.InsertParameters("productID").DefaultValue = productID sqlOrders.InsertParameters("totalPrice").DefaultValue = "0.00" sqlOrders.InsertParameters("status").DefaultValue = "Paid"
I currently have this code in the SQLDataSource_Inserting sub but the first line only works once the record is inserted. How can i get the ID out as im inserting the parameters?
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 have an editable grid where user can add/edit data. They also have the option to load previously entered data from last month. When the user then clicks save, i want to readd this newly modified data as a new record for this month. So basically I want to call the insertcommand, but it does not work. My 'save' method just 'updates' the records.
Providing sqldatasource, grid and save method <asp:SqlDataSource ID="SqlDataSourceLoadActivities" runat="server" [code].....
I have the logged-in user's Guid stored in a session variable. My understanding is that when the Guid is passed to the session variable it becomes a string. When I use the detailsview control I have to convert the session variable back to a guid and I've been doing it like this and it seems to work fine:
e.values("UserId") = session("LoggedInUserId") Dim UserId as Guid = New Guid()
When I try to use the Insert() command after the following:
I get an "InvalidCastException" error with the comment "Conversion from type 'Guid' to type 'String' is not valid." I'm assuming the session variable needs to be converted to a type Guid since that's what I've had to do with the Detailsview control. I've tried a few different ways of converting the session variable back to a Guid so the insert command will work, but no matter which method of conversion I try I get errors such as "value of type system.guid cannot be converted to 'string'. I'm confused because I thought I was supposed to convert it from a string to a Guid. The "UserId" parameter is a non-primary key uniqueidentifier in the database.
I have a table right now with just customer_id and customer_name and I want to add an image field to upload their logo.
I've searched and found articles on how to create a table and to upload an image for a new row but how do I update or add a picture to an existing row.
So if I browse through my table and found a customer without a logo or an outdated logo, how do I replace and update their logo?
I want to insert data in my tblOrder with surent paramater
I get the controls out of al my paramaters.
But ons of my controls contains the text of a Title of a book.
In my table i want to to insert this book_id. The title of this book is in an other table tblBoek. But i want to enter al my data in tblOrders.
TblOrders Tbloek
ID ID Naam Titel Boek_ID Auteur
the Boek_ID is i an relationship with the ID form tblBoek
SQL:"INSERT INTO tblOrders (ID, NAME, ADDRESS, DATE, BOOK_ID,) " + "WHERE "VALUES (@Id, @Name, @Address, @Date, )"; //for my parameters these values are in controls
"FROM tblOrders INNER JOIN tblBooks ON tblOrders.BOOK_ID = tblBooks.BOOK_ID";