Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2003-05-22 : 08:13:32
|
| Eric writes "We have a Cobalt Raq550 Linux rack Server, that runs Sun One ASP pages and is connected through the internet to a SQL 2k server on a Win2k machine.We are trying to return the identity of of a newly inserted record, simple enough on IIS but the linux Apache returns an infinite number.My ASP Code:Set getSiteID = CreateObject("ADODB.Connection") getSiteID.Open(MM_Connection_STRING) SQL2 = "INSERT INTO dbo.tblSiteConfigs (subDomainName) VALUES ('"&subDomainName&"')" getSiteID.Execute(SQL2) ' get ID of record we just inserted SQL2 = "SELECT @@IDENTITY AS NewID" Set rsNewID2 = getSiteID.Execute(SQL2) newSiteID = rsNewID2.Fields("NewID").value 'Close the recordset getSiteID.Close() Set getSiteID = Nothing Response.Write(newSiteID)On Windows newSiteID = 5On Linux newSiteID = 9.50737950171172E+29 The identity field in the table is "int" and set to identityAny Idea why linux returns a differnt value ?" |
|
|
SamC
White Water Yakist
3467 Posts |
Posted - 2003-05-22 : 08:51:55
|
| Look at [url]http://sqlteam.com/item.asp?ItemID=422[/url]Sam |
 |
|
|
ValterBorges
Master Smack Fu Yak Hacker
1429 Posts |
Posted - 2003-05-22 : 10:44:49
|
I would also consider putting this into a stored procedure and using command objects.Stored procedures will give you many benefits some important ones being maintainability, reusability, interoperability and performance.For commands that don't return anything it improves performance.You can set up parameters with out having to create strings, this makes your code easier to understand (uhmmm, maybe not a good thing if job protection is what you seek). |
 |
|
|
|
|
|