ASP to MSACCESS : set conn = Server.CreateObject("ADODB.Connection") conn.open "DRIVER={Microsoft Access Driver (*.mdb)}; " & "DBQ=" & Server.MapPath("access.mdb") accessquery = "sql statement here" set rs = conn.Execute(accessquery) conn.close set conn = nothing
ASP to Mysql : set conn = Server.CreateObject("ADODB.Connection") conn.open "DRIVER={MySQL};SERVER=sqlservers;DATABASE=database_name;;UID=user_name;PWD=password" sqlquery = "sql statement here" set rs = conn.Execute(sqlquery) set rs = conn.Execute(accessquery) conn.close set conn = nothing
PHP to mysql: $conn = mysql_connect("sqlserver", "user", "temp123") or die ("Could not connect"); print ("Connected successfully"); mysql_select_db ("database_name") or die ("Could not select database");
$query = "sql statement here"; $result = mysql_query ($query) or die ("Query failed");
mysql_close($conn);
ASP.NET (VB) to MSACCESS : dim objConn as OleDbConnection Sub Page_Load (obj as Object, e as EventArgs) objConn = New OleDbConnection("Provider=Microsoft.Jet.oledb.4.0;Data Source=" & Server.MapPath("access.mdb")) dim objCmd as OleDbcommand = new OleDbCommand("sql statement here", objConn) Try objCmd.Connection.Open() objCmd.ExecuteNonQuery() Catch ex as OleDbException response.write("Error retrieving data") Finally objCmd.Connection.Close() End Try End Sub
ASP to MSSQL 2000 : set conn = server.createobject("Adodb.connection") conn.open Application("connectionString") conn.open "Provider=SQLOLEDB;Data Source=sqlservers;UID=username;pwd=temp12;database=database_name" set rs=server.CreateObject("ADODB.RECORDSET" rs.open "sql statement here", conn, 3 ,1 conn.close set conn = noth set conn = nothing
ColdFusion to MySQL : cfscript driver="DRIVER={MySQL}"; server="SERVER=sqlservers"; database="DATABASE=database_name"; user="UID=user_name"; pass="PWD=temp123"; conn="#driver#;#server#;#database#;#user#;#pass#;option=16386"; /cfscript
cfquery DBTYPE="dynamic" CONNECTSTRING="#conn#" NAME="sql" select statement here; /cfquery
ASP.NET (c#) Mysql : Private const string ConnStr = "Driver={MySQL ODBC 3.51Driver};" +"Server=sqlserver;Database=database_name;uid=user_name;pwd=temp123;option=3; Protected override void OnInit(EventArgs e) { base.OnInit(e); Using(OdbcConnection conn = new OdbcConnection(ConnStr)) Using(OdbcCommand cmd = new OdbcCommand("select satement here", conn)) { conn.Open(); DS1.DataSource =cmd.ExecuteReader(CommandBehavior.CloseConnection CommandBehavior.SingleResult); DS.DataBind(); } }
|