|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
According to “Beginning Active Server Pages 3.0” from Wrox, Data Source Names
“are a largely outdated method of specifying connection details, mainly because they use ODBC drivers instead of OLE-DB providers to handle the data. We include them here only because you may come across DSNs when working with legacy systems.” Which is better: using ODBC with a mySql database or not using ODBC with this type of database? Also, based on the model below, how do you create a connection to a mySql database (using myODBC and not using myODBC)? Please note that I will be testing the database on my PC but it will also be used on a website. Also, how do you handle the Sql? Thanks for any help you can offer, Robin ************************************************* Example for connecting to an MS Access database: <% Set objCmd=Server.CreateObject("ADODB.Command") Set objConn=Server.CreateObject("ADODB.Connection") objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source =" &_ Server.mappath("databases\ws_shopping.mdb") %> Example SQL: <% Set objRS1 = Server.CreateObject("ADODB.Recordset") CartQuery = "SELECT CUSTID, INUM, ORDERDATE, CARTQTY " & _ "FROM ShoppingCart " & _ "WHERE CUSTID = '" & logName & "' " & _ "ORDER BY INUM " objRS1.Open CartQuery, objConn, adOpenKeyset, adLockOptimistic, adCmdText Set objCmd.ActiveConnection = objConn MaxCustQuery = "SELECT MAX(CNUM) AS MaxCNum FROM Customers" objCmd.CommandType = adCmdText objCmd.CommandText = MaxCustQuery Set rsMax = objCmd.Execute If Not IsNull (rsMax("MaxCNum")) Then intCNum = rsMax("MaxCNum") End If %> |
|
#2
|
|||
|
|||
|
You need to get the MyODBC drivers for MySQL. Download links and documentation are at www.mysql.com
I think there are some (not free) OLEDB drivers for MySQL somewhere but I've never used them. There are occasions where DSN's are a good thing! |
|
#3
|
|||
|
|||
|
I downloaded the mySql manual from www.mySql.com and didn't see any connection string or code for ASP.
Robin |
|
#4
|
|||
|
|||
|
Try the MyODBC documentation.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > MS Access, mySql and ASP |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|