Microsoft Word - Sam's Teach Yourself MySQL in 21 Days - SAMS.doc

(singke) #1

90 Dim strSQL


100 'Create the ADO objects


110 Set mCmd = Server.CreateObject("ADODB.Command")


120 Set mConn = Server.CreateObject("ADODB.Connection")


130 'Set up the Connection


140 mConn.CommandTimeout = 40


150 mConn.ConnectionTimeout = 40


160 mConn.ConnectionString = "server=10.1.1.50;driver=MySQL;" &_


"db=Meet_A_Geek;uid=root;pwd=tacobell"" ""


170 mConn.Open


180 'Build the SQL string


190 strSQL = "INSERT INTO Customers"


200 strSQL = strSQL & "(Customer_ID, First_Name, Last_Name, Address,"


210 strSQL = strSQL & " City, State, Zip, Email, Age, Gender, Race, "


220 strSQL = strSQL & "Eye_Color, Activity, Movie, Occupation. Smoker)"


230 strSQL = strSQL & " VALUES(NULL, " &_


240 Request("Contact_FirstName") & ", "


250 strSQL = strSQL & Request("Contact_LastName") & ", "


260 strSQL = strSQL & Request("Contact_MiddleInitial") & ", "


270 strSQL = strSQL & Request("Contact_Address") & ", "


280 strSQL = strSQL & Request("Contact_City") & ", "


290 strSQL = strSQL & Request("Contact_State") & ", "


300 strSQL = strSQL & Request("Contact_Zip") & ", "


310 strSQL = strSQL & Request("Contact_Email") & ", "


320 strSQL = strSQL & Request("Contact_Age") & ", "

Free download pdf