473,394 Members | 1,946 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Using LOAD DATA INFILE in ASP.NET 2005

19
Hello everyone,

I have used load data infile in my ASP.NET Project to import the csv file data to my database.

For ex: my database contains : name address id fields.

But my text file contains only name and address , so these two fields sucessfully get imported to the database but now what I have to do is to add id value for that imported row.

I have used:


MySqlCommand loadcmd = new MySqlCommand("LOAD DATA INFILE '" + txtfilename.Text + "' into Table temporarytable fields terminated by ','lines terminated by '\n'(name,address),cn);

//loadcmd.ExecuteNonQuery();


MySqlCommand updatecmd = new MySqlCommand("UPDATE temporarytable SET BranchId='"+ddlBranchName.SelectedItem.Value+"', cn);

loadcmd.ExecuteNonQuery();
//insertcmd.ExecuteNonQuery();
updatecmd.ExecuteNonQuery();

Actually I am stuck that in update query , that what I should use in Where clause. If you all can suggest that what should I do , please help.
Dec 1 '07 #1
0 813

Sign in to post your reply or Sign up for a free account.

Similar topics

14
by: Bruce A. Julseth | last post by:
When I execute this SQL statement in my PHP code, I get an error "File '.\Address.txt' not found (Errcode: 2)" $File = addslashes(".\Address.txt"); $SQL = "Load Data InFile \"" . $File . "\"...
6
by: jim.kelly | last post by:
Hi all, I'm having trouble with the following line of code in my php script: $result = mysql_query('LOAD DATA LOCAL INFILE "NYSE_".$today.".txt" INTO TABLE main FIELDS TERMINATED BY "," LINES...
3
by: hall | last post by:
I have a problem with my design of a templatized class. I'm trying to figure out how to load and save the data inside it, but can't. My class looks like this ------------------------------------...
4
by: Bruce A. Julseth | last post by:
I have three users with access to my test MySQL databases, root plus two others. The following PHP code only works when the user is root. Otherwise it fails. $File = addslashes(getcwd() ....
5
by: Michael Sperlle | last post by:
Is it possible? Bestcrypt can supposedly be set up on linux, but it seems to need changes to the kernel before it can be installed, and I have no intention of going through whatever hell that would...
1
by: Ted | last post by:
I managed to get it installed OK, along side MS Visual Studio 2005 (with which I received it). During the install, I made sure I installed everything. I have developed a number of applications...
1
by: Megi | last post by:
welcome, I input data form file to mysql with command: load data local infile.. The efect is that the data are duplicated or trippled..etc with every re-loading the script, but I need to load...
3
by: Eric_Dexter | last post by:
I am trying to take some data in file that looks like this command colnum_1 columnum_2 and look for the command and then cange the value in the collum(word) number indicated. I am under...
1
by: gouthamirao | last post by:
I need to insert values into tables. I am doing it using sqlloader. Evrything is going fine, except the columns with CLOB datatype. I am unable to insert them, I am getting an error. This is the...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.