I m writing a very typical ASP script which insert a record into one table with an identity column and then get the id generated and insert into another table.
Table_1 columns:
id_1
name
Table_2 columns:
id_1
id_2
But in with the ASP script below, I can't get the id_1 back. Code:
I know in SQL Server that you can increment a field by one with Identity, but have read where if 2 or more people submit information at the same time this number may be duplicated. Is there a way to keep from having an incremental number duplicated if 2 or more people submit information at the same time?
' Insert a new record into the table lsSQL = "INSERT INTO tMembers (MemberName) VALUES ('Manohar');" &_ "SELECT @@IDENTITY AS NewID;"
I want to collect one more value from the newly created recordset. It's a replication ID field. Can i add one more item to the values being collected or should i just use another recordset and retrieve data i'm after.
Set RS=CN.Execute("INSERT into tableX yada yadayada ; SELECT SCOPE_IDENTITY()")
Using Profiler, I see the statement go through. But ASP gives me an error saying RS is not an object. "Operation is not allowed when the object is closed."
In these lines if not RS.EOF then theNewId=RS.Fields(0) end if
If I run the same query in QueryAnalyzer, I do get a return value.
i'm trying to retrieve the @@Identity ID in sql so i can insert it into my other tables. the following code works in access, but not sure how it would retrieve it in sql. Code:
i have a webpage which has 3 forms and each of the form has a about 20 controls. now what i want is to have these controls displayed in a mixed manner on the screen. moreover the ACTION pages of all the three forms are different. so is there anyway in which we can specify that TO WHICH FORM do they belong
my page is something like this
FORM1 starts TEXTBOX(of FORM1) FORM2 starts TEXTBOX(of FORM2) BUTTON(of FORM1) END OF FORM1 TEXTBOX(of FORM2) END OF FORM2
I have made a asp page that accepts some data from user and stores it in MS Access database. Now I want to identify the user who filled the form and store this information in database. About the enviornment.
the server has Windows 2000 server installed. Clients have Windows XP. Server also has Exchange 2003 installed and every client has Outlook Express installed. Every user has to login to his account inorder to use a machine. A given user can login on any machine.
How can i find the identity of the user who submitted the form? Is it possible to find out the current logged in user given the IP address of the machine? If yes, how and will there be any chances of error due to delay in replication?
I have a web page that adds records to multiple tables. I want to be able to get the new identity of a new record that was just added to the table. If for some reason, it didn't add, I want an error message to show up.
Here's the code in stored procedure for getting the new product id after the record was added. Code:
Is there a way in ASP (3.0, not .NET) for me to determine who the current windows users is (i.e. the user who was authenticated and who is "running" this IIS session)?
Am having a bit of trouble with the @@identity field - I probably just have that friday feeling and am missing off something obvious, but the below code brings back am empty identity value ("sid" appears empty). I've definitely set up an identity field in the tblSurvey:
I am doing a webpage which allows different users from various departments to do a search/print information of people within their own department. I have a login page for user to key in the correct password and id before they enter the system. However, in order for the restriction to take place, I will have to ensure that the system recognises the person that is logged into the system.
we have just migrated to a new server both with database and web server- migrating all web projects and all databases.then we decided to rename the new server.we tried running all web projects on the new server but it doesnt work causing error "configured identity incorrect, check username and password" in a certain line in the code.
i have searched for possile solutions like synchronizing identity account in the 3 locations where this account is stored but it seems it doesnt work. Earlier i was able to fix scheduled jobs in the database not working caused by renaming the new server which is also the name of the database server.But problems in the web files itself (asp) are giving me headache particularly in code lines with "createobject."
Whats seems to be the particular problem?Can anyone point me to the right resources to fix this prob?
I am trying to retrieve a record identity from a SQL Server auto-incremented field on insert statement.
Here is the error I am getting can anyone please help me
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]Cannot insert explicit value for identity column in table 'cwm_Report_Request_Form' when IDENTITY_INSERT is set to OFF.