Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

asp & sql 1

Status
Not open for further replies.

vbprogrammer

Programmer
Jul 16, 2001
11
US
hi. do any of you kind techies know of a good way to access adobd through sql & vbs? my code, which doesn't work:

dim oConn
dim oCommand
dim oRS
dim strConnect

Set oConn = New ADODB.Connection
strConnect="Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=Kauri;Data Source=systemsource01"
oConn.Open strconnect
 
try, adding password in connect string.
and make sure user id and password has access to database
first try with these options.
 
Are you using NT Security or SQL Server Security? If you are using NT Security the USER ID and PWD are irrelevant. If you are using SQL Server Security, you need BOTH in your connection string. Add this to your connection string if you are using NT Security...Provider =SQOLEDB.1;Integrated Security =SSPI;... Also note that in Visual Basic you can run a build connection wizard on the ADODC control on your form.
 
I have had great success with this method

<%
Set Conn = server.CreateObject(&quot;ADODB.Connection&quot;)
Conn.Open &quot;driver=SQL Server;server=yourserver.com;uid=USERID;pwd=PASSWORD;database=DATABASE;&quot;
Set RS = Conn.Execute(&quot;SELECT Count(*) AS Recs FROM [Copy-PartMaster Lite] Where [STOCK_CODE] Like

N'%&quot; &amp; pnum &amp; &quot;%' And [Description] Like N'%&quot; &amp; desc &amp; &quot;%'&quot;)
Set RS2 = Conn.Execute(&quot;SELECT * From Customers Where [CUSTOMER] ='&quot; &amp; Customer &amp; &quot;'&quot;)
Response.Write &quot;Terms: &quot; &amp; RS2(&quot;PYMTRMID&quot;)
%>
<br>
Records Found&amp;nbsp; <%=RS(&quot;Recs&quot;)%>
<br> DougP, MCP

Visit my WEB site to see how Bar-codes can help you be more productive
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top