Conexão com mysql
Pessoal eu preciso de uma ajuda pra criar uma conexão com o mysql,mas não sei como fazer.Meu sistema é em acces por isso estou querendo trocar.a página responsável pela busca e por cadastrar novos sites no bd possuem uma include chamando um arquivo .INCEis o arquivo .INC
<%Dim adoCon 'Database Connection VariableDim rsConfiguration 'Holds the configuartion recordsetDim strCon 'Holds the Database driver and the path and name of the databaseDim strSQL 'Holds the SQL query for the databaseDim intRecordsPerPage 'Holds the number of files shown on each pageDim strBgColour 'Holds the background colourDim strTextColour 'Holds the text colourDim strTextType 'Holds the font typeDim intTextSize 'Holds the font size Dim strLinkColour 'Holds the link colourDim strTableColour 'Holds the table colourDim strTableBorderColour 'Holds the table border colourDim strVisitedLinkColour 'Holds the visited link colourDim strHoverLinkColour 'Holds the mouse over link colour'Declare constants' ----------------- Change the following line to the number of entries you wish to have on each page and miniumum word length ------------------------Const intMinuiumSearchWordLength = 1 'Change this to the minimum word length to be searched on'-------------------------------------------------------------------------------------------------------------------------------------'Create database connection'Create a connection odjectSet adoCon = Server.CreateObject("ADODB.Connection") '------------- If you are having problems with the script then try using a diffrent driver or DSN by editing the lines below -------------- 'Database connection info and driver (if this driver does not work then comment it out and use one of the alternative drivers)strCon = "DRIVER={Microsoft Access Driver (.mdb)}; DBQ=" & Server.MapPath("search_engine.mdb")'Database driver for Brinkster'strCon = "DRIVER={Microsoft Access Driver (.mdb)}; DBQ=" & Server.MapPath("/USERNAME/db/search_engine.mdb") 'This one is for Brinkster users place your Brinster username where you see USERNAME'Alternative drivers faster than the basic one above'strCon = "Provider=Microsoft.Jet.OLEDB.3.51; Data Source=" & Server.MapPath("search_engine.mdb") 'This one is if you convert the database to Access 97'strCon = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("search_engine.mdb") 'This one is for Access 2000/2002'If you wish to use DSN then comment out the driver above and uncomment the line below (DSN is slower than the above drivers)'strCon = "DSN = DSN_NAME" 'Place the DSN where you see DSN_NAME'---------------------------------------------------------------------------------------------------------------------------------------------'Set an active connection to the Connection objectadoCon.Open strCon'Read in the configuration for the script'Intialise the ADO recordset objectSet rsConfiguration = Server.CreateObject("ADODB.Recordset")'Initialise the SQL variable with an SQL statement to get the configuration details from the databasestrSQL = "SELECT tblConfiguration.* From tblConfiguration;"'Query the databasersConfiguration.Open strSQL, strCon'If there is config deatils in the recordset then read them inIf NOT rsConfiguration.EOF Then 'Read in the configuration details from the recordset intRecordsPerPage = CInt(rsConfiguration("No_records_per_page")) strBgColour = rsConfiguration("bg_colour") strTextColour = rsConfiguration("text_colour") strTextType = rsConfiguration("text_type") intTextSize = CInt(rsConfiguration("text_size")) strLinkColour = rsConfiguration("links_colour") strTableColour = rsConfiguration("table_colour") strTableBorderColour = rsConfiguration("table_border_colour") strVisitedLinkColour = rsConfiguration("visited_links_colour") strHoverLinkColour = rsConfiguration("active_links_colour")End If'Reset server objectSet rsConfiguration = Nothing%>
É só nesse arquivo que preciso mudar ou nas outras páginas tbm?As tabelas no Mysql ja estão okObrigado pessoal
Discussão (2)
Carregando comentários...