473,385 Members | 1,907 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

asp connection to SQL server DB

Good Day,

Just want to ask some help please, currently I'm using MS Access as my database but now I would like to use SQL DB as my database. Could anyone help me how to convert my connection string from ms access to sql db. below is my connection on ms access please do modification to work it on SQL. Many thanks in advance.
Expand|Select|Wrap|Line Numbers
  1. <%
  2.     dim strConn 
  3.     strConn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="& server.MapPath("bts_db.mdb") &";Persist Security Info=False;Jet OLEDB:Database Password = prs"
  4.     function get_recordset(byval strSQL, byref recset)
  5.         on error resume next
  6.         set recset =  Server.CreateObject("ADODB.Recordset")
  7.         recset.open strSQL, strConn, 3
  8.         if err.number <> 0 then
  9.             Response.Write err.Description & "<br>"
  10.             Response.Write err.Source & "<br>"            
  11.             Response.Write strSQL
  12.             Response.End
  13.         end if
  14.         get_recordset = recset.recordcount
  15.     end function
  16.  
  17.     sub Execute_Query (byval strSQL)
  18.         on error resume next
  19.         dim con
  20.         Set con = Server.CreateObject("adodb.Connection")
  21.         con.open strConn
  22.         con.BeginTrans
  23.         con.execute strSQL
  24.         if err.number <> 0 then
  25.             Response.Write err.Description & "<br>"
  26.             Response.Write err.Source & "<br>"
  27.             Response.Write strSQL & "<br>"
  28.             Response.End
  29.             con.RollbackTrans
  30.         else
  31.             con.CommitTrans
  32.         end if
  33.         Set con = nothing
  34.     end sub
  35. %>
Nov 6 '09 #1
1 1601
jeffstl
432 Expert 256MB
http://www.connectionstrings.com/
Nov 20 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Fortepianissimo | last post by:
Here is the situation: I want my server started up upon connection. When the first connection comes in, the server is not running. The client realizes the fact, and then starts up the server and...
6
by: Paul Robinson | last post by:
I am developing a website in ASP that connects to a Sybase database. However, when I try to open a connection to the database the page will not load. The script does not timeout, nor the...
5
by: Fred Zuckerman | last post by:
Hello All, After reading in this group about the preference for connecting to a SQL Server using a connection string instead of a DSN file, I have done just that. BUT, I cannot update my data....
6
by: Sharon | last post by:
Hi all. I'm trying first time async socket connection. In all the examples i've seen, the server connection is closed when the message is complete. Is it common to close the connection after...
3
by: Martin B | last post by:
Hallo! I'm working with C# .NET 2.0, implementing Client/Server Applications which are connecting via Network to SQL-Server or Oracle Databases. To stay independent from the underlaying Database...
5
by: Suresh | last post by:
Hi Guys I have Db2 server installed on remote server. i am connecting to that remote server by using VPN. I want to connect that remote DB2 server instance using my local machine DB2...
16
by: crbd98 | last post by:
Hello All, Some time ago, I implemented a data access layer that included a simple connectin pool. At the time, I did it all by myself: I created N connections, each connection associated with...
1
by: Sankalp | last post by:
Hi, I am using VB 2005. My application has many data bound controls. The connection is stored in the app.config file. I want the application to start with a default connection string and while...
20
by: fniles | last post by:
I am using VS2003 and connecting to MS Access database. When using a connection pooling (every time I open the OLEDBCONNECTION I use the exact matching connection string), 1. how can I know how...
2
by: Johnson | last post by:
I'm trying to fix a "sub optimal" situation with respect to connection string management. Your thoughtful responses will be appreciated. I just started with a new client who has a bunch of legacy...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.