|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Read autonumbering field from dbconvert to sql server quickly. Consequently this is maybe not a very wice question - but it is SO important to us :-) ** this works in access - but not on sql server: Tabel contains 2 fields: id = autonumbering text = textfield **** Set Con = CreateObject(â€ADODB.Connection Con.open "PROVIDER=SQLOLEDB;DATA SOURCE=192.168.2xx.xx;UID=xxxxxx;PWD=xxxxxxxx;DATABASE=xxxxxx" Set RS=CreateObject(â€ADODB.RecordSetâ€) RS.Open â€Select * FROM testâ€, 1, 3 RS.AddNew RS(â€Textâ€) = â€test tekst†RS.Update Response.write RS(â€textâ€) & â€was given id=†& RS(â€idâ€) RS.Close Con.Close ’********************************************************* this should output the given id number - which is actually IN the database. But in the output from above - it is blank ... Thanx in advance :-) Take a look at the @@IDENTITY, SCOPE_IDENTITY and IDENT_CURRENT functions for
SQL server in Books Online. -- Show quote"Jensgjerloev" wrote: > Situation: We are blank new to SQL server (previosuly access) and we need to > convert to sql server quickly. Consequently this is maybe not a very wice > question - but it is SO important to us :-) > ** > this works in access - but not on sql server: > > Tabel contains 2 fields: > id = autonumbering > text = textfield > **** > Set Con = CreateObject(â€ADODB.Connection > Con.open "PROVIDER=SQLOLEDB;DATA > SOURCE=192.168.2xx.xx;UID=xxxxxx;PWD=xxxxxxxx;DATABASE=xxxxxx" > Set RS=CreateObject(â€ADODB.RecordSetâ€) > RS.Open â€Select * FROM testâ€, 1, 3 > RS.AddNew > RS(â€Textâ€) = â€test tekst†> RS.Update > Response.write RS(â€textâ€) & â€was given id=†& RS(â€idâ€) > RS.Close > Con.Close > ’********************************************************* > this should output the given id number - which is actually IN the database. > But in the output from above - it is blank ... > Thanx in advance :-) > > THANKs Mark - will do saturday morning.
Right now and here: Is there a command we need to add ? Best regards Jens Show quote "Mark Williams" wrote: > Take a look at the @@IDENTITY, SCOPE_IDENTITY and IDENT_CURRENT functions for > SQL server in Books Online. > > -- > > > "Jensgjerloev" wrote: > > > Situation: We are blank new to SQL server (previosuly access) and we need to > > convert to sql server quickly. Consequently this is maybe not a very wice > > question - but it is SO important to us :-) > > ** > > this works in access - but not on sql server: > > > > Tabel contains 2 fields: > > id = autonumbering > > text = textfield > > **** > > Set Con = CreateObject(â€ADODB.Connection > > Con.open "PROVIDER=SQLOLEDB;DATA > > SOURCE=192.168.2xx.xx;UID=xxxxxx;PWD=xxxxxxxx;DATABASE=xxxxxx" > > Set RS=CreateObject(â€ADODB.RecordSetâ€) > > RS.Open â€Select * FROM testâ€, 1, 3 > > RS.AddNew > > RS(â€Textâ€) = â€test tekst†> > RS.Update > > Response.write RS(â€textâ€) & â€was given id=†& RS(â€idâ€) > > RS.Close > > Con.Close > > ’********************************************************* > > this should output the given id number - which is actually IN the database. > > But in the output from above - it is blank ... > > Thanx in advance :-) > > > > THANKX Mark - it's working now - thanks to your help :-))
Best Regards Jens Show quote "Mark Williams" wrote: > Take a look at the @@IDENTITY, SCOPE_IDENTITY and IDENT_CURRENT functions for > SQL server in Books Online. > > -- > > > "Jensgjerloev" wrote: > > > Situation: We are blank new to SQL server (previosuly access) and we need to > > convert to sql server quickly. Consequently this is maybe not a very wice > > question - but it is SO important to us :-) > > ** > > this works in access - but not on sql server: > > > > Tabel contains 2 fields: > > id = autonumbering > > text = textfield > > **** > > Set Con = CreateObject(â€ADODB.Connection > > Con.open "PROVIDER=SQLOLEDB;DATA > > SOURCE=192.168.2xx.xx;UID=xxxxxx;PWD=xxxxxxxx;DATABASE=xxxxxx" > > Set RS=CreateObject(â€ADODB.RecordSetâ€) > > RS.Open â€Select * FROM testâ€, 1, 3 > > RS.AddNew > > RS(â€Textâ€) = â€test tekst†> > RS.Update > > Response.write RS(â€textâ€) & â€was given id=†& RS(â€idâ€) > > RS.Close > > Con.Close > > ’********************************************************* > > this should output the given id number - which is actually IN the database. > > But in the output from above - it is blank ... > > Thanx in advance :-) > > > > |
|||||||||||||||||||||||