<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Problem with connectivity of Ms SQL through VBScript in Operating System - Microsoft</title>
    <link>https://community.hpe.com/t5/operating-system-microsoft/problem-with-connectivity-of-ms-sql-through-vbscript/m-p/3826061#M7347</link>
    <description>Hi &lt;BR /&gt;&lt;BR /&gt;I want to connect the SQL through VBScript. But it is not working. And I am not able to fine where is the problem. &lt;BR /&gt;&lt;BR /&gt;So if anyone understand the problem, please suggest me what should I change, or what is going wrong.&lt;BR /&gt;&lt;BR /&gt;The VBScript I am using:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;' Initialize variables&lt;BR /&gt;&lt;BR /&gt;Dim cn &lt;BR /&gt;Dim ServerName&lt;BR /&gt;Dim DatabaseName&lt;BR /&gt;&lt;BR /&gt;Set cn = CreateObject("ADODB.Connection")&lt;BR /&gt;' Put text box values into connection variables.&lt;BR /&gt;ServerName = "pfabwsus.dlh.st.com"&lt;BR /&gt;DatabaseName = "NITIN"&lt;BR /&gt;&lt;BR /&gt;WSCript.Echo "Test 1"&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;' *******************************************************&lt;BR /&gt;' Specify the OLE DB provider.&lt;BR /&gt;cn.Provider = "SQLOLEDB"&lt;BR /&gt;&lt;BR /&gt;' Set SQLOLEDB connection properties.&lt;BR /&gt;cn.Properties("Data Source").Value = ServerName&lt;BR /&gt;cn.Properties("Initial Catalog").Value = DatabaseName&lt;BR /&gt;&lt;BR /&gt;' Windows NT authentication.&lt;BR /&gt;cn.Properties("Integrated Security").Value = "SSPI"&lt;BR /&gt;'********************************************************&lt;BR /&gt;&lt;BR /&gt;'WScipt.Echo cn.Properties("ConnectionTimeout")&lt;BR /&gt;&lt;BR /&gt;WScript.Echo "Connection Properties are set."&lt;BR /&gt;' Open the database.&lt;BR /&gt;cn.Open&lt;BR /&gt;&lt;BR /&gt;WScript.Echo "Connection Established."&lt;BR /&gt;cn.Close&lt;BR /&gt;cn.Connection = Nothing&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The same thing I am writing in the attachment.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks and Regards&lt;BR /&gt;Nitin Kumar Gupta&lt;BR /&gt;</description>
    <pubDate>Wed, 19 Jul 2006 01:58:45 GMT</pubDate>
    <dc:creator>Nitin Kumar Gupta</dc:creator>
    <dc:date>2006-07-19T01:58:45Z</dc:date>
    <item>
      <title>Problem with connectivity of Ms SQL through VBScript</title>
      <link>https://community.hpe.com/t5/operating-system-microsoft/problem-with-connectivity-of-ms-sql-through-vbscript/m-p/3826061#M7347</link>
      <description>Hi &lt;BR /&gt;&lt;BR /&gt;I want to connect the SQL through VBScript. But it is not working. And I am not able to fine where is the problem. &lt;BR /&gt;&lt;BR /&gt;So if anyone understand the problem, please suggest me what should I change, or what is going wrong.&lt;BR /&gt;&lt;BR /&gt;The VBScript I am using:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;' Initialize variables&lt;BR /&gt;&lt;BR /&gt;Dim cn &lt;BR /&gt;Dim ServerName&lt;BR /&gt;Dim DatabaseName&lt;BR /&gt;&lt;BR /&gt;Set cn = CreateObject("ADODB.Connection")&lt;BR /&gt;' Put text box values into connection variables.&lt;BR /&gt;ServerName = "pfabwsus.dlh.st.com"&lt;BR /&gt;DatabaseName = "NITIN"&lt;BR /&gt;&lt;BR /&gt;WSCript.Echo "Test 1"&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;' *******************************************************&lt;BR /&gt;' Specify the OLE DB provider.&lt;BR /&gt;cn.Provider = "SQLOLEDB"&lt;BR /&gt;&lt;BR /&gt;' Set SQLOLEDB connection properties.&lt;BR /&gt;cn.Properties("Data Source").Value = ServerName&lt;BR /&gt;cn.Properties("Initial Catalog").Value = DatabaseName&lt;BR /&gt;&lt;BR /&gt;' Windows NT authentication.&lt;BR /&gt;cn.Properties("Integrated Security").Value = "SSPI"&lt;BR /&gt;'********************************************************&lt;BR /&gt;&lt;BR /&gt;'WScipt.Echo cn.Properties("ConnectionTimeout")&lt;BR /&gt;&lt;BR /&gt;WScript.Echo "Connection Properties are set."&lt;BR /&gt;' Open the database.&lt;BR /&gt;cn.Open&lt;BR /&gt;&lt;BR /&gt;WScript.Echo "Connection Established."&lt;BR /&gt;cn.Close&lt;BR /&gt;cn.Connection = Nothing&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The same thing I am writing in the attachment.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks and Regards&lt;BR /&gt;Nitin Kumar Gupta&lt;BR /&gt;</description>
      <pubDate>Wed, 19 Jul 2006 01:58:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-microsoft/problem-with-connectivity-of-ms-sql-through-vbscript/m-p/3826061#M7347</guid>
      <dc:creator>Nitin Kumar Gupta</dc:creator>
      <dc:date>2006-07-19T01:58:45Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with connectivity of Ms SQL through VBScript</title>
      <link>https://community.hpe.com/t5/operating-system-microsoft/problem-with-connectivity-of-ms-sql-through-vbscript/m-p/3826062#M7348</link>
      <description>Hello Nitin, &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 19 Jul 2006 03:21:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-microsoft/problem-with-connectivity-of-ms-sql-through-vbscript/m-p/3826062#M7348</guid>
      <dc:creator>Soujanya</dc:creator>
      <dc:date>2006-07-19T03:21:23Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with connectivity of Ms SQL through VBScript</title>
      <link>https://community.hpe.com/t5/operating-system-microsoft/problem-with-connectivity-of-ms-sql-through-vbscript/m-p/3826063#M7349</link>
      <description>Hi again &lt;BR /&gt;&lt;BR /&gt;This weblink would be of much help .. Check this out :&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.databasejournal.com/features/mssql/article.php/2238221" target="_blank"&gt;http://www.databasejournal.com/features/mssql/article.php/2238221&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;You can also try this chunk of code : &lt;BR /&gt;&lt;BR /&gt;sql="SELECT * FROM UserLogs"&lt;BR /&gt;Set Connection = CreateObject("ADODB.Connection")&lt;BR /&gt;Connection.Open&lt;BR /&gt;(" Provider=sqloledb;server=MyMSSQLServerNa&lt;BR /&gt;me;database=NameOfDatabaseIUsed;uid=SQLU&lt;BR /&gt;serName;pwd=SQLUserPWD;")&lt;BR /&gt;Set RS = CreateObject("ADODB.RecordSet")&lt;BR /&gt;RS.ActiveConnection = Connection&lt;BR /&gt;&lt;BR /&gt;RS.Open(sql)&lt;BR /&gt;Do While Not RS.BOF And Not RS.EOF&lt;BR /&gt;    WScript.Echo(RS(1))&lt;BR /&gt;    RS.MoveNext&lt;BR /&gt;Loop&lt;BR /&gt;RS.Close&lt;BR /&gt;&lt;BR /&gt;Set RS = Nothing&lt;BR /&gt;Connection.Close&lt;BR /&gt;Set Connection = Nothing&lt;BR /&gt;&lt;BR /&gt;-- code ends --&lt;BR /&gt;&lt;BR /&gt;word wrapping might occur for Set Connection and Connection.Open statements.&lt;BR /&gt;&lt;BR /&gt;If you have trouble authenticating with domain credentials, create a&lt;BR /&gt;SQL user and passed those credentials. Everything will work fine.&lt;BR /&gt;&lt;BR /&gt;For more help on VBScript, you can find the attachment in my previous post.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Soujanya.R&lt;BR /&gt;</description>
      <pubDate>Wed, 19 Jul 2006 03:35:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-microsoft/problem-with-connectivity-of-ms-sql-through-vbscript/m-p/3826063#M7349</guid>
      <dc:creator>Soujanya</dc:creator>
      <dc:date>2006-07-19T03:35:43Z</dc:date>
    </item>
  </channel>
</rss>

