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 |
|
ssholl
Starting Member
2 Posts |
Posted - 2012-09-17 : 09:34:54
|
| HI All,Something weird is going on with my query, im connecting to sql through VBS, my table looks like the belowFirstNameSurnameDepartmentwhen i run the below query i get each row 3 times, if i add another field i get it 4 times etc, it returns the same row as many times there are columns.my statement is belowset conn = CreateObject("ADODB.Connection") conn.Open "Provider=SQLOLEDB;Data Source=Localhost\sqlexpress;Trusted_Connection=Yes;Initial Catalog=Starters;User ID=MYUSERNAME;Password=MYPASSWORD;"Set rs = CreateObject("ADODB.RecordSet")rs.Open "select * from NewStarters" , conn For each x in RS.Fields FirstName =RS.Fields(0).Value Wscript.echo FirstName Nextrs.closeconn.closeany ideas why |
|
|
ssholl
Starting Member
2 Posts |
Posted - 2012-09-17 : 09:53:29
|
| Ok ive slightly updates it and get something differentwhile rs.EOF=FalseFor each x in RS.Fields FirstName = rs.fields("FirstName") wscript.echo FirstName Surname = rs.fields("Surname") Wscript.echo Surname Description = rs.fields("Department") Wscript.echo Department NextWendrs.closeconn.close this will give this error(9, 2) ADODB.Field: Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.If i move the NEXT to below Wend, it just repeats over and over |
 |
|
|
|
|
|