|
Thank you Henry for all your help. I will look into this today.
|
|
|
|
|
Hi Henry,
I have read a couple articles on escape sequences and have tried to include the same line of code(just modified to fit what I need) and I still get errors. Maybe I am looking in the wrong place but when I try and use
Extended Properties=\"\"text;HDR=Yes;FMT=Delimited(" + gds + ");\"\";"; it says I need to add ";". But when I add one it tells me I need to add another. However, if I were to plug the line of code above into the code found in the Code Project page it seems fine. I think what is happening is that there is something wrong with the first part of the connection string, maybe the Source.
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Path.GetDirectoryName(FilePath) + @";
Could you look at this one more time for me and point me in the right direction when you have time please? Here is the entire connection string:
String comString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Path.GetDirectoryName(FilePath) + @";Extended Properties=\"\"text;HDR=Yes;FMT=Delimited(" + gds + ");\"\";";
Thank you,
Brenton
|
|
|
|
|
I have found an article that is doing what I think you are trying to do.
Read text file (txt, csv, log, tab, fixed length)[^], it only uses one \" instead of two.
Have a look and see if it helps.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
That did it Henry. Thank you so much. Is there something I need to do is far as closing this out or giving you a rating? Let me know and I will come back.
|
|
|
|
|
Thanks for the thanks!
If you would just vote one of my posts as a 5, then people will know that your question has been answered.
Good luck!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Sorry, I was using automatic properties which may not be available in the version that you're working with.
Follow Henry's advice and use a private member variable that the property getter and setter accesses.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
There are two layers in my project. one is business layer,and the other is UI layer.
In UI layer, i invoke the method 'SaveInfo' of business layer. by the way ServiceActivator.GetService.
But i can't get 'newInfo' in UI layer.
and if i remove 'throw ex;' in 'SaveInfo' method. i could get it.
i don't know why.
do you know? how could i get newInfo if i want to throw Exception to UI layer.
pls. ths.
'SaveInfo' in Business layer:
public void SaveInfo(ref StudentInfo info,ref List<studentinfodetail> detailList,string strType)
{
try
{
...
info = newInfo;
detailList = newDetailList;
throw new MyException("Information already exist.");
...
}
catch(Exception ex)
{
throw ex;
}
}
the invoke code in UI layer:
try
{
...
mMyDs.SaveInfo(ref curInfo,ref curList,"Add");
...
]
catch(MyException mex)
{
textBox1.text = curInfo.Name;
}
catch(Exception ex)
{
}
MSN:msnadair@hotmail.com
Skype:skyadair
modified on Tuesday, May 12, 2009 8:52 PM
|
|
|
|
|
I have to say that returning to a calling process by throwing an exception is not the normal way to do it.
It would be better to give SaveInfo() a return type of bool and instead of throw new MyException use return true; .
Then in your calling code use
if (mMyDs.SaveInfo(ref curInfo,ref curList,"Add"))
{
}
else
{
}
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
No,i can't. i need to do this.
i should return the latest data from database if the info already exist. and the info may have different status, i should throw out the hint.
MSN:msnadair@hotmail.com
Skype:skyadair
|
|
|
|
|
I have a serial ports list. I declared it like this:
<br />
private List<SerialPort> lstSerialPorts;<br />
<br />
for (int i = 1; i<=cont; i++)<br />
{<br />
SerialPort tempPort = new SerialPort("COM" + cont.ToString(), 2400);<br />
lstSerialPorts.Add(tempPort);<br />
lstSerialPörts[i].DataReceived += SerialDataReceivedEventHandler(TEST_FUNCTION);<br />
}<br />
My TEST_FUNCTION is empty so far:
<br />
<br />
void TEST_FUNCTION(object sender, SerialDataReceivedEventArgs e)<br />
{<br />
throw new NotImplementedException();<br />
}<br />
As you can see, all serial ports have the same handler function. How could I check which serial port triggered the TEST_FUNCTION? It would be great something like this:
<br />
void TEST_FUNCTION(object sender, SerialDataReceivedEventArgs e)<br />
{<br />
Console.WriteLine("This function was triggered by: {0}",anUnknownVariable);<br />
}<br />
Parameter "e" does not have any useful property or function
Any help would be apreciated and excuse me about my English if I made a mistake
Ivan
|
|
|
|
|
You've looked at the e parameter - now try the other one!
The clue is in the name 'sender'. Cast it to a SerialPort from object and you now have the object that raised the event.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Use the sender object, cast it to SerialPort and you will get the object who triggered the function.
Sincerely Samer Abu Rabie
Imagination is more important than knowledge !
|
|
|
|
|
If 'e' is not a lot of use, have you considered looking at 'sender', by any chance?
If you expand it in the debugger, you may find it is a SerialPort object.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Thx a lot guys
|
|
|
|
|
I know your proble is solved but something I noticed in the code and wondered if it was correct.
Should new SerialPort("COM" + cont.ToString()
be new SerialPort("COM" + i.ToString() ?
Good of you to thank the guys. Not everyone does.
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
|
|
|
|
|
Yeah my mistake typing that... Thanks!
|
|
|
|
|
I want my application to programatically download a file from skydrive.live.com,
but I encountered a problem:
Microsoft uses script for file download that makes it impossible to download the file using WebClient (at least as far as I know). Could somebody help to find a workaround on how to download the file?
The microsoft's script is:
Download
var $SelfPage = new function()
{
var _download = 'http\x3a\x2f\x2f5odcbq.bay.livefilestore.com\x2fy1pi19dAInfgawlhjDTcs2sbdCJEkvL7jzsz8SVx9qA-EiQwX-ZPeg-DCt63IEoNWu7USu9uUA-j9FkUosBKqU-3Q\x2fApskaita_1.1_beta_update.exe';
var _demote = 'http\x3a\x2f\x2f5odcbq.bay.livefilestore.com\x2fy1pi19dAInfgawlhjDTcs2sbdCJEkvL7jzsz8SVx9qA-EiQwX-ZPeg-DCt63IEoNWu7USu9uUA-j9FkUosBKqU-3Q\x2fApskaita_1.1_beta_update.exe';
var _dirty = false;
this.MarkDirty = function() { _dirty = true; }
this.Download = function()
{
if (_dirty)
{
_dirty = false;
window.location = _demote;
}
else
{
window.location = _download;
}
}
}
|
|
|
|
|
Hi I don't know if anyone could help me. I'm beginner on C# programing and I have an assignment to finish and i don't know how to finish!!!
I started creating a program with a menu with options to creates a new file and read the new file. The files that I create have an boundary limits(not less than 125 and no more than 350 characters in number) and after creating and saving the file there is an option to go to main menu. This is the part that I've done. Now I have to after writting on the new file create an option to encript and save the file and when opening the file it should have another option to go back to plain text format(decrypt). The encryption should be represented as numbers grouped in pairs, and it should create alternate numbers(written twice). for some single letters ( the most common ones a,e,o,r,t), also using null characters I have to include some mechanism for introduce spaces!!! I really apreciate if anyone could help me with some suggestions,
Thanks
|
|
|
|
|
I would encrypt using built in encryption classes like Rijndael-Managed, what is it you want to do, exactly?
|
|
|
|
|
I'm on my first year of C# i've learnt all the basic but I don't know how to encrypt or decrypt any message, that is my biggest problem. Really I don't know how to convert characters to integers,
Thanks for your help
|
|
|
|
|
sofi79 wrote: don't know how to convert characters to integers
Convert.ToInt32(char)[^]
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
sofi79 wrote: I don't know how to convert characters to integers
Probably because it's so simple:
char c = 'a' ;
int i = c ;
System.Console.WriteLine ( i ) ;
c = (char) i ;
I'd be interested in hearing more about this simple encryption process.
|
|
|
|
|
I always assumed I needed an explicit Convert calls here. Learn something new everyday.
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
|
|
|
|
|
The Convert class is evil; don't use it.
|
|
|
|
|
Are you being serious?
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
|
|
|
|