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 |
|
joe iacoponi
Starting Member
11 Posts |
Posted - 2002-04-08 : 21:23:01
|
| I just recently switched from a DSN connection to a SQLOLEDB connection to my SQL 7 server from ASP.We immediately started having a problem with one specific .AddNew Method while requesting a .Value return on the Identity. The return value is now zero instead of the correct record inserted.Interestingly, I have an almost identical process in another ASP program that works fine. The program flow is somewhat different, but the connection is the same:Set OBJdbConnection = Server.CreateObject("ADODB.Connection")OBJdbConnection.Open "Provider=SQLOLEDB; Data Source=127.0.0.1; Initial Catalog=Mydb; User ID=MyID; Password=MyPW"Set rsAddHeader = Server.CreateObject("ADODB.Recordset")rsAddHeader.ActiveConnection = OBJdbConnectionrsAddHeader.CursorLocation = 3 'adUseClientrsAddHeader.CursorType = 1 'adOpenKeysetrsAddHeader.LockType = 3 'adLockOptimisticrsAddHeader.Source = "ItemHeader"rsAddHeader.OpenrsAddHeader.AddNewrsAddHeader("ItemType") = ItemTypersAddHeader("ItemDate") = Now()rsAddHeader("StatusCode") = "R"rsAddHeader("StatusDate") = Now()rsAddHeader("ItemType") = 1rsAddHeader.Update Session("ItemNumber") = rsAddHeader.Fields("ItemNumber").Value Response.Write "ItemNumber: " & Session("ItemNumber")Anybody have any idea what might be causing this bizarre problem??? |
|
|
Merkin
Funky Drop Bear Fearing SQL Dude!
4970 Posts |
Posted - 2002-04-08 : 22:35:03
|
| HiInstead of your "source " parameter, try rs.open "Select * from Table WHERE 1=0"and see what that gives you.Damian |
 |
|
|
|
|
|