Retrieving @@Identity ID In Sql
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:
View Repliesi'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:
View RepliesI 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?
View Replies View Related' 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.
I tried the following:
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.
Am I missing something?
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 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?
Is it possible to use <identity impersonate> in ASP?(not ASP.net)
View Replies View RelatedI have some asp that should be inserting a shopper into my SQL Server DB. Code:
View Replies View RelatedI 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)?
View Replies View Relatedis there any way I retrieve record identity from data that i just insert in...
View Replies View RelatedAm 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:
set rsAdd = Server.CreateObject("ADODB.Recordset")
rsAdd.open "tblSurvey", conn, 3 , 3
rsAdd.AddNew
rsAdd("title") = title
rsAdd("intro") = intro
rsAdd("enddate") = enddate
rsAdd.Update
Set rsIdentity = Conn.Execute("SELECT @@IDENTITY AS sid")
sid = rsIdentity("sid")
....any ideas would be greatly appreciated.
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.
View Replies View Relatedwe 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.
/cwm/Admin/reportrequest.asp, line 66
here is my code:
When a new record is inserted into access db it creates an id, how can I return this value for a record I have just created?
View Replies View RelatedI have the following code in my form:
Response.Write("<form name='Testing'>");
Response.Write("<INPUT type=hidden id='Testing_txtbox'
name='Testing_txtbox' value='a simple test'>");
Response.Write("</form>");
If I type the following in the very next line, I get a value of
"undefined".
Response.Write("value="+Request.Form("Testing_txtbox"));
why this won't work. and how I can retrieve values of hidden controls via Server side code?
I have a DTD xml doc and need to read the data from it and display it using ASP.
View Replies View RelatedI want to know if there is a way to retrieve the tag from the URL, I don't know if thats its name, so I'll just explain what it is:
showmsg.asp?FID=mn&ID=2467#2529
the tag, as I call it is what follows the # sign, the number 2529, in this case. so, is there a way I can retrieve the tag with ASP, by the request object, or any other way, any Ideas? Another thing I wanted to know, not related to this subject, is how do I change value of a textarea that is placed in another window with VBscript or JAVA. is it possible?
I have three different tables I will be pulling stuff from: user_info, img_inv, activitylog:
user_info I will be using their ID and state
img_inv I will be using part number
activitylog I will be using part number and date
I'm trying to select the part number from the activities list and match it with the img_inv to make sure it still exist. If it exist I want it to do a total count of how many times it has been looked at by 7 states within a given quarter. Code:
I want to retrieve the value of a cookie to make a form a little more user friendly (our intranet is configured to set a cookie for User First Name, Last Name and Email when they log in)
Unfortunately I can't figure out how to retrieve the value of the cookie. I've been trying:
<%
Response.write Request.Cookies(UserLName)
%>
But it gives me an error - I used Checky to make sure the cookies are there and they do exist:
Name:mascot
Value: UserLName=Tarby
Can someone give me some advice?
i want some help in how to retrieve values from multiple selection listbox. i want the values retrived to be used in the search which i perform from the database. i m doing a search feature which u all often see in job search sites. so someone selects multiple cities to search in i want that to include that in my search query.
View Replies View RelatedIs there a way in asp to retrieve part of the URL and use it
say the url was
http://localhost/site/craig
is there anyway of retrieving the word craig so to use it in the page
This is because i could have other addresses that are for example
http://localhost/site/Jon
where i need to retrieve the word jon
I have a form that send values to a second page. i m trying to compare the values received from the form with other values retrieved from a database. so if a value already exists then an error message is displayed. in order to compare the values i need to print them on the second page but I m bit stuck with this. i used request.form("category") in order to retrieve the values from the form but it doesn t work.
I am trying to get a field populated in an oracle database with a time stamp of when a form is submitted.
I have found out that there is a table in Oracle called DUAL which holds the current date and time. At present i can populate the date when the form is submitted using objrs('sub_date')=date() but when i query the database the time element of the field sub_date, the time displayed is 00:00 which is the default time.
So can anyone give me any help in how i can capture the time. I know about select to_char(sub_date,'DD-MON-YYYY HH24:MI') which will bring up the time but i can seem to populate the field sub_date with the time.
I am trying to retrieve the page name. I know this is possible using Server Variable PATH_INFO. The problem I am having though is that when I get to a page in one of my subdirectories the subdirectory name is displayed.
Example: my page index.asp is in the the admin directory so the PATH_INFO displays as /admin/index.asp. How can I strip the page name out so I get index.asp. I cannot use the function Right() since the page name could be any length.
How to retrieve "Last modified" & "FileName" from all files in a specific folder (called MyDocs) and display on the ASP page?
eg. (in MyDocs folder)
- MikesWork.doc
- MyResume.xls
- HouseExpenses.xls
Situation
Let's assume that i just modified MyResume.xls file and save it today(10/30/2003) on my computer, then i upload it into the internet. On my asp page, i want to show all files Filename (Last Modified) in MyDocs folder.
eg.
Your Documents
1. MikesWork.doc (last modified 10/24/2003)
2. MyResume.xls (last modified 10/30/2003)
3. HouseExpenses.xls (last modified 9/15/2003)
I know it has to do with fso or something close to it... but totally have no idea (zero) of its logic or how it works. Please help me by giving me with full example.
I'm writing a vbscript application that reads UTF-8 XML containing Chinese
characters and stores the data in MySql 4.0.x.
Does anybody have any experience in this area with regarding codepage and
character sets? Ideally I want the scripts to be able to handle Standard
European characters and Chinese characters as well.
Are there any special considerations for using MySql/ODBC and ADO to get and
put the data.
Right I have my files going into the database, and once successfully uploaded, a user is shown a few bits of information in a table such as the primary key, name of file, its size and the content type.Now i want to create <a href> links on the homepage etc so that browsers/users can download these files one at a time. So when they click the link, the Save.Open or Cancel dialog box appears. Have been trying different things for few days now but finally thought I better ask for some help as Im gettin nowhere.
View Replies View RelatedI have a zipfile that is created dynamically for me on a webserver. I have the url of the zip sent as a post value to an asp script on my website.
In my asp script I need to be able to retrieve the zip file so that i may extract content from it using an asp zip component. Any idea how to retrieve the file?
I have a SQL statement to retreive results based on keywords entered
I only want to show the first 200 characters of the field though, how would I modify this code to do just that?
SQL = SQL + " instr( 1, lcase( description ), lcase( '" + aKeywords(i) + "' ), 1 ) > 0"
I thought it would have been something like:
SQL = SQL + " (left(instr( 1, lcase( description ), lcase( '" + aKeywords(i) + "' ), 1 ), 200) > 0"
i have a checkout page which lists the user and what they have puchased. however, theres a problem with this page as I cant retrieve the user from both tables in my db, Customer & Corporate. The error message that I received is:
Microsoft VBScript compilation (0x800A03F4)
Expected 'If'
/shop/check_out.asp, line 412, column 3
End
--^
which refers to the red line in the code below: Code: