|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Loop through MS SQL data with VBScriptHello,
I need to write a script that will loop through data within a MS SQL database and print to a specific printer. I'm totally green when it comes to VBScript, so I'm not sure if this is possible and if so, what commands to research. Can someone point me in the right direction? Thanks, Alex You can use ADO Connection/RecordSet to read data, like this way:
Dim cn Dim rs Dim connectionString connectionString="......" Set cn=CreateObject("ADODB.Connection") cn.Open connectionString Set rs=CreateObject("ADODB.RecordSet") rs.Open "SELECT Col1,Col2 FROM theeTable WHERE ....",cn ''Loop trough the recordset Do Until rs.EOF ''Do whatever with the data in the record rs.MoveNext Loop rs.Close cn.Close Show quote "Alex" <sama***@gmail.com> wrote in message news:1155824007.647769.302670@b28g2000cwb.googlegroups.com... > Hello, > > I need to write a script that will loop through data within a MS SQL > database and print to a specific printer. I'm totally green when it > comes to VBScript, so I'm not sure if this is possible and if so, what > commands to research. > > Can someone point me in the right direction? Thanks, > > Alex > |
|||||||||||||||||||||||