Hi!

Just had to convert a asp website I have from Acces to MS SQL Express.

Is this an OK way to connect to the database?
It works great, but I just wanted to know if this is the best way to do
it....
The code runs on the same surver as the sql express server.


AdoConnection = "Provider=SQLOLEDB.1; Data Source=xxx.xx.xxx.xxx;Initial
Catalog=DatabaseName;Persist Security Info=True;User ID=sa;Password=Pass"

ConnectString = AdoConnection
Set conn = Server.CreateObject("ADODB.Connection")
conn.open ConnectString

sqlBruker = "SELECT Fornavn FROM Bruker"
Set rsBruker = Server.CreateObject("ADODB.Recordset")
rsBruker.Open sqlBruker, conn, 3, 3
Response.Write(rsBruker("Fornavn"))
rsBruker.close
set rsBruker=nothing

Best regards,
Christopher Brandsdal

Re: Moving on to SQL Express by Ray

Ray
Fri May 12 08:18:39 CDT 2006

Close. Explicitly creating a recordset is an extra step that isn't
required. Check out:

http://www.aspfaq.com/show.asp?id=2424
http://www.aspfaq.com/show.asp?id=2191

Ray at work

"Christopher Brandsdal" <christopher@valdres.no> wrote in message
news:uwXoV7adGHA.4900@TK2MSFTNGP02.phx.gbl...
> Hi!
>
> Just had to convert a asp website I have from Acces to MS SQL Express.
>
> Is this an OK way to connect to the database?
> It works great, but I just wanted to know if this is the best way to do
> it....
> The code runs on the same surver as the sql express server.
>
>
> AdoConnection = "Provider=SQLOLEDB.1; Data Source=xxx.xx.xxx.xxx;Initial
> Catalog=DatabaseName;Persist Security Info=True;User ID=sa;Password=Pass"
>
> ConnectString = AdoConnection
> Set conn = Server.CreateObject("ADODB.Connection")
> conn.open ConnectString
>
> sqlBruker = "SELECT Fornavn FROM Bruker"
> Set rsBruker = Server.CreateObject("ADODB.Recordset")
> rsBruker.Open sqlBruker, conn, 3, 3
> Response.Write(rsBruker("Fornavn"))
> rsBruker.close
> set rsBruker=nothing
>
> Best regards,
> Christopher Brandsdal
>



Re: Moving on to SQL Express by John

John
Mon May 15 05:35:31 CDT 2006

"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
message news:uHMMXacdGHA.4912@TK2MSFTNGP05.phx.gbl...
> Close. Explicitly creating a recordset is an extra step that isn't
> required. Check out:
>
> http://www.aspfaq.com/show.asp?id=2424
> http://www.aspfaq.com/show.asp?id=2191
>
> Ray at work
>
> "Christopher Brandsdal" <christopher@valdres.no> wrote in message
> news:uwXoV7adGHA.4900@TK2MSFTNGP02.phx.gbl...
>> Hi!
>>
>> Just had to convert a asp website I have from Acces to MS SQL Express.
>>
>> Is this an OK way to connect to the database?
>> It works great, but I just wanted to know if this is the best way to do
>> it....
>> The code runs on the same surver as the sql express server.
>>
>>
>> AdoConnection = "Provider=SQLOLEDB.1; Data Source=xxx.xx.xxx.xxx;Initial
>> Catalog=DatabaseName;Persist Security Info=True;User ID=sa;Password=Pass"


Don't you think it is a touch dangerous connecting as System Administrator?

Create another user, assign appropriate permissions, use that instead.

--
John Blessing

http://www.LbeHelpdesk.com - Help Desk software priced to suit all
businesses
http://www.room-booking-software.com - Schedule rooms & equipment bookings
for your meeting/class over the web.
http://www.lbetoolbox.com - Remove Duplicates from MS Outlook, find/replace,
send newsletters



Re: Moving on to SQL Express by Christopher

Christopher
Wed May 31 13:53:00 CDT 2006

Thanks! Worked great :)


"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> skrev i
melding news:uHMMXacdGHA.4912@TK2MSFTNGP05.phx.gbl...
> Close. Explicitly creating a recordset is an extra step that isn't
> required. Check out:
>
> http://www.aspfaq.com/show.asp?id=2424
> http://www.aspfaq.com/show.asp?id=2191
>
> Ray at work
>
> "Christopher Brandsdal" <christopher@valdres.no> wrote in message
> news:uwXoV7adGHA.4900@TK2MSFTNGP02.phx.gbl...
>> Hi!
>>
>> Just had to convert a asp website I have from Acces to MS SQL Express.
>>
>> Is this an OK way to connect to the database?
>> It works great, but I just wanted to know if this is the best way to do
>> it....
>> The code runs on the same surver as the sql express server.
>>
>>
>> AdoConnection = "Provider=SQLOLEDB.1; Data Source=xxx.xx.xxx.xxx;Initial
>> Catalog=DatabaseName;Persist Security Info=True;User ID=sa;Password=Pass"
>>
>> ConnectString = AdoConnection
>> Set conn = Server.CreateObject("ADODB.Connection")
>> conn.open ConnectString
>>
>> sqlBruker = "SELECT Fornavn FROM Bruker"
>> Set rsBruker = Server.CreateObject("ADODB.Recordset")
>> rsBruker.Open sqlBruker, conn, 3, 3
>> Response.Write(rsBruker("Fornavn"))
>> rsBruker.close
>> set rsBruker=nothing
>>
>> Best regards,
>> Christopher Brandsdal
>>
>
>