vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hello, Im brand new and trying to learn SQL Server 2000, I have purchased a book and been reading it for a few weeks. I'm tring to find an ASP script that would let me know if my connection to my database is working. I use DSN, i created a DSN name "mail" anyone have any scripts? -- Message posted via http://www.sqlmonster.com |
| |||
| Hi Check out: http://www.aspfaq.com/show.asp?id=2351 There are loads of things on that site which you will find useful. John "Chad Benjamin via SQLMonster.com" <forum@SQLMonster.com> wrote in message news:96fc54d1d15b43f3ab5b707ecee86301@SQLMonster.c om... > Hello, > > Im brand new and trying to learn SQL Server 2000, I have purchased a book > and been reading it for a few weeks. > > I'm tring to find an ASP script that would let me know if my connection to > my database is working. > > I use DSN, i created a DSN name "mail" > > anyone have any scripts? > > -- > Message posted via http://www.sqlmonster.com |
| |||
| You really want to use DSN-less connections. Your code will be portable. But, to use your DSN connection you would do the following: <% dim cn set cn = Server.CreateObject("ADODB.Connection") cn.ConnectionString = "DSN=mail.dsn" cn.Open if cn.State <> 1 then Response.Write "Could not connect to database" else Response.Write "Connected!!" end if cn.Close set cn = nothing %> On 3/28/05 2:02 PM, in article 96fc54d1d15b43f3ab5b707ecee86301@SQLMonster.com, "Chad Benjamin via SQLMonster.com" <forum@SQLMonster.com> wrote: > Hello, > > Im brand new and trying to learn SQL Server 2000, I have purchased a book > and been reading it for a few weeks. > > I'm tring to find an ASP script that would let me know if my connection to > my database is working. > > I use DSN, i created a DSN name "mail" > > anyone have any scripts? |
| |||
| Hi I tried your code you gave me but got an error. [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified any ideas? -- Message posted via http://www.sqlmonster.com |
| ||||
| That code was for a File DSN. You would need to change the code to include the full path to the file. A system DSN (probably what you are using) should look like this. cn.Open "DSN=mail;" & _ "Uid=user;" & _ "Pwd=password" Of course, you need to edit "user" and "password" -Greg On 3/29/05 3:26 AM, in article c5100b24cbd74b26ab4c260c9d59e74a@SQLMonster.com, "Toby Benjamin via SQLMonster.com" <forum@SQLMonster.com> wrote: > Hi I tried your code you gave me but got an error. > > [Microsoft][ODBC Driver Manager] Data source name not found and no default > driver specified > > > any ideas? |