|
"Provider=Microsoft.Jet.OLEDB.4.0;"
+ "Data Source=\"" + dir + "\\\";"
+ "Extended Properties=\"text;HDR=No;FMT=Delimited\"";
I'm using the above connection, together with a SELECT * FROM file statement, to pull in data from a comma-delimited text file, where dir is the directory where the file is located and file is the name of the csv file.
This works well for files that contain English characters only, but for any file that uses non-English (ASCII) characters, the expression fails.
I have written the csv file using a StreamWriter with Encoding=UTF8 so the characters display fine when viewed in Notepad or Excel, but when pulled into the DataTable, the value in the table is blank. Is there some Extended Property that can be used to permit East Asian characters, say, to be displayed properly? Thanks.
|
|
|
|
|
Does this[^] helps?
जय हिंद
|
|
|
|
|
Hi All,
While downloading files from FTP server using WEBClient class, I'm able to download first file (while looping through all the files)to my local system after that i'm getting the error "The remote server returned an error: (530) Not logged in".
The credentials are correct as the first file is getting downloaded successfully
Following is the code
FileInfo fi = new FileInfo(strFileName);
if (!fi.Extension.ToLower().Equals(".csv")) return false;
if (serverUri.Scheme != Uri.UriSchemeFtp)
{
return false;
}
// Get the object used to communicate with the server.
using (WebClient request = new WebClient())
{
//request.Proxy = null;
//request.BaseAddress = serverUri.ToString();
// This example assumes the FTP site uses anonymous logon.
string strUsername, strPassword;
strUsername = this.FtpUserName;
strPassword = this.FtpPassword;
request.Credentials = new NetworkCredential(strUsername, strPassword);
string strListeningDir = "";
strListeningDir = this.ListeningDirectory;
strFileName = this.FileName;
try
{
Logger.Write(serverUri.ToString());
newFileData = request.DownloadData(serverUri.ToString().Trim());
fileString = System.Text.Encoding.UTF8.GetString(newFileData);
FileStream fs = new FileStream(strListeningDir + strFileName, FileMode.Create);
fs.Write(newFileData, 0, newFileData.Length);
Logger.Write("File copied to listening directory...");
fs.Close();
GC.Collect();
}
catch (WebException e)
{
throw e;
}
}
return true;
|
|
|
|
|
1. Use the pre tags for your code.
2. What line do you get the exception on?
|
|
|
|
|
hi everyone
I would like to know how to code a server to create an application in C # client / server.
The database used is SQL server, it contains 7 tables.
And more specifically how I can code a server in c # so that multiple users can simultaneously access and complete their treatment (addition, modification, deletion, printing, consulting, research)
I hope to have an answer because it will determine my future work.
Thank you in advance
|
|
|
|
|
tech.csharp wrote: multiple users can simultaneously access and complete their treatment
Concurrency can be handled at the database level and google can provide a lot of help on it.
tech.csharp wrote: addition, modification, deletion
There is a huge namespace SQLClient dedicated for this purpose. Use the classes it has to offer.
Here[^] is an article that can help you.
जय हिंद
|
|
|
|
|
I half expect a reply consisting of; "Thanks, but where r the codez."
|
|
|
|
|
Thank you for your help, and I would like to know how I can insert my access code to database sql, for example customer identification (login and password in the fields of the table)
Thank you once again
|
|
|
|
|
Check out the SqlCommand class, and create a SQL connection using System.Data.SqlClient.SqlConnection class, don't forget to check out this link[^] for information on how to construct a connection string.
|
|
|
|
|
Thank you for your help but I know how create a sql connection string but what I don't know is to manage the connection to a sql server database in a client/server application and any necessary treatment.
|
|
|
|
|
Hi
I am getting this error while creating the setup file.....
The following files may have dependencies that cannot be determined automatically. Please Confirm that all Dependencies have been added to the project.
C:\windows\mscomm32.ocx
how solve it... Please give me Solution
THanks in advance
|
|
|
|
|
your project depend on mscomm32.ocx
and may be you have been taken this project copy and paste so you must add this tool(mscomm32.ocx) again
|
|
|
|
|
Hi Sir
I added it but the Result is Same...
is there any other way to solve...
|
|
|
|
|
Use the SerialPort control instead of mscomm32.ocx.
|
|
|
|
|
basically I want to clear the selection and keep a context menu from coming up if the user right clicks in empty space beneath the last row. The MouseDown event fires before the CellMouseDown event so I can't have the latter set a flag to control the former. The former gives a mouse coordinate but I don't see a way to check if it's on a row or not.
It is a truth universally acknowledged that a zombie in possession of brains must be in want of more brains.
-- Pride and Prejudice and Zombies
|
|
|
|
|
As to this comment:
dan neely wrote: I don't see a way to check if it's on a row or not
there's the HitTest[^] method. You may find the example code in the docs useful.
|
|
|
|
|
Thanks. The only problem with kitchen sink classes is that intelligence isn't that helpful when it returns 10 zillion items.
It is a truth universally acknowledged that a zombie in possession of brains must be in want of more brains.
-- Pride and Prejudice and Zombies
|
|
|
|
|
Hi all,
I am quite new to C# and I bumped into this issue and I cannot understand why it is happening. I have a list of objects of class1. class1 has, as a member variable a list of objects of class2, and class2 has as a member variable a list of objiects of class3. In my code I have to add some objects to the list of objects of class3 for the last element of the list of objects of class2 for one of the elements of the list of objects of class1. It seems it should be straight forward but i found a strange behaviour and maybe you clever people can help me make some sense out of it.
I'll explain with an example: if the list of objects of class1 has 2 elements (ListClass1[0] and ListClass2[1]) and I do
ListClass1[0].ListClass2[ListClass1[0].ListClass2.Length-1].ListClass3.Add(ObjClass3)
at the end of this I find that the ObjClass3 has been added to ListClass1[1].ListClass2[ListClass1[1].ListClass2.Length-1].ListClass3
Why is that happening?
Is there any way around this?
Cheers
Mauri
|
|
|
|
|
If I were you, I would rewrite that piece of code to make it more readable.
Also, without the code for your classes, it is very difficult to figure out what is happening.
Please format your code correctly using the <pre> and <code> tags.
|
|
|
|
|
Hmmmm, that is a strange one...
my first though is that the objects stored in ListClass1 are refrences to the same object so changing one would alter them all.
Can you confirm this is not the case?
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Perhaps ListClass[1] and ListClass[2] are pointing to the same object? If they're reference types, then assigning them to be equal to one another would have that effect, I think
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
now i feel daft. yes, that was the problem. Thanks guys, much appreciated.
Mauri
|
|
|
|
|
I URGENTLY NEED A POO, CAN SOMEBODY PLEASE DO IT FOR ME?!?!
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
|
Like I said, very urgent, no time to check the instructions.
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|