shanerobinson Posted July 15, 2008 Share Posted July 15, 2008 Hi Everyone,I need some help please! i have a simple MySql database setup and if i run the code below directly in the MySql query browser it works fine!load data local infile 'C:/Users/robinsons/Documents/data.csv' into table contactsfields terminated by ','enclosed by '"'lines terminated by '\n'(firstname, lastname, address1, address2, phone)This code is just importing the data from my CSV file and inserting it into my database.My question is does anybody have any code that i could run from an ASP page to do the exact same process as above?Thankyou... Link to comment Share on other sites More sharing options...
justsomeguy Posted July 15, 2008 Share Posted July 15, 2008 You can send those same commands in ASP. Using java script: var dbcon = Server.CreateObject("ADODB.RecordSet");dbcon.ActiveConnection = "your connection string";var query = "load data local infile 'C:\\Users\\....' into table contacts\n";query += "fields terminated by ','\n";query += "enclosed by \"\"\n";query += .....dbcon.open(query); That will load a local file on the server into the database like the code you have above. If you want to upload a file first and import that then that's another issue. Link to comment Share on other sites More sharing options...
shanerobinson Posted July 16, 2008 Author Share Posted July 16, 2008 Thankyou i will give that option a try... Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.