|
ShiraRK wrote: I need to get the text from a .mht file
Good, so you read the file in
ShiraRK wrote: only the text that the user sees,
no special charachters, no "=".
so you need to do some manipulation
ShiraRK wrote: I also need the same for .html.
and save it to a web page.
Post the code yuo have and maybe someone will help. Otherwise, what you actually need is RENTACODER.COM, where, for a samll fee, someone will write your code for you.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
I coded folowing:
public void PWriteToEventLog(Exception ex)
{
EventLog lLog = new EventLog();
lLog.Source = "Data Access Error... ";
lLog.WriteEntry(ex.Message.ToString());
}
public DataTable PGetDataTable(string vConn, string vStrSQL, string vTableName)
{
//variable to return
DataTable lDataTable;
//variable to process
OleDbConnection lConn = new OleDbConnection(vConn);
OleDbCommand lComm = new OleDbCommand(vStrSQL, lConn);
OleDbDataAdapter lAdapter = new OleDbDataAdapter();
try
{
lConn.Open();
lAdapter.SelectCommand = lComm;
}
catch (Exception ex)
{
this.PWriteToEventLog(ex);
throw new Exception("Error from [PGetDataTable]\n" + ex.ToString());
}
try
{
lDataTable = new DataTable(vTableName);
lAdapter.Fill(lDataTable);
lConn.Close();
}
catch (Exception ex)
{
this.PWriteToEventLog(ex);
throw new Exception("Error ... \n" + ex.ToString());
}
return lDataTable;
}
When I run. It notice bug: Unhandle exception has your occured in your application.
Error... system.data.oledbexception: sysntax error in from Clause.
|
|
|
|
|
And yet, you posted all this crap, but not the for clause so we can tell you what's wrong with it ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
thuyphuongid wrote: public DataTable PGetDataTable(string vConn, string vStrSQL, string vTableName)
What madness is this ? Why do your methods and variables start with a letter ? What does P stand for ? Tell me v is not for 'variable' ???
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
vConn is string: @"Provider = Microsoft.Jet.OLEDB.4.0; Data source = Dat.mdb";
I code like that. So, I want to build Library for Access.
|
|
|
|
|
OK, so v stands for string ? Well, that's horrid, but whatever.
If you want help, you'll have to give us your SQL, because that's where the error is, that's what the error message says. It seems to me unlikely that you've been coding for long if you don't understand that, so you have time to revisit your coding standard, which is kind of messy. You don't need to put a letter before methods, ever, and even variables, it just makes them hard to read.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Christian Graus wrote: You don't need to put a letter before methods, ever, and even variables
How about just keeping first letter of its datatype? Something like this:
string sConn;
Loading signature. Please wait...
|
|
|
|
|
Well, that's hungarian notation and it makes more sense, I guess, but it's very much out of vogue nowadays. The IDE will tell you the data type easy enough.
The P in front of method names was more bizarre.
I note he's still not actually given us the info we need to fix his bug.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Christian Graus wrote: that's hungarian notation
Not really used anymore.
Christian Graus wrote: P in front of method names was more bizarre
That got me scratching my head. Wondering what the hell that was.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
v: express variable of method
l: local in method.
vStrSQL = "select * from User where user = 'aaa' and passwd = 'bb';
I tested vStrSQL on MS Access. It is true.
It used folow:
vStrSQL = "select * from User where User = '" + txtUser.Text + "' and Passwd = '" + txtPassword.Text + "'";
DataTable lTbl = mUti.PGetDataTable(mConnectString, mStrSQL, "tbl");
////
Error ...
System.Data.OleDb.OleDbException: Syntax error in FROM clause.
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.OleDb.OleDbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
|
|
|
|
|
Sorry! It is not contain mUti.
It correct:
DataTable lTbl = PGetDataTable(mConnectString, mStrSQL, "tbl");
|
|
|
|
|
Why do your methods start with a P ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Got me on that one
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
May be, P = procedure.
But wait do we have procedures in C#. Atleast I am not aware.
Loading signature. Please wait...
|
|
|
|
|
thuyphuongid wrote: v: express variable of method
l: local in method.
Can I suggest you do this with casing instead ? In any case, why does it matter, if a variable was passed in, unless it's a class ?
You realise that your code means I can erase your database during the login process if I feel like it ? Research SQL Injection attacks.
Could it be that you're calling a method that requires only a single result, but you're doing a select * ? What if you do a select Top 1 * ?
Or could it be because your table name and a column name are the same ?
The SQL itself looks fine, you are right there.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Ok. Thank you for your help. See u later.
|
|
|
|
|
In your code, as Christian has said, you are open to sql injection attacks with the string concatenation. Read this fine article preventing sql injection attacks[^]. It is a very good reading and worth bookmarking.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Christian Graus wrote: Research SQL Injection attacks
I noticed that with the wonderful string concatenation going on there.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
I have created this wallapaper in Fireworks. Please give me the comments. To view full goto: Click Here
Software Development & Web Development is my addiction. I am a Visual C# 2.0 and ASP.NET 2.0 Developer and working in Visual Studio 2005 using Dot Net Framework 2.0.
Email: bottomless.wisdom@hotmail.com
Web: http://bottomless-wisdom.spaces.live.com
|
|
|
|
|
|
|
Pretty stupid IMO.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
[Homer Simpson voice over] Lame [/Homer Simpson voice over]
Thanks for wasting 5 seconds of my afternoon
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
YOU ARE AN IDIOT.
Blog link to be reinstated at a later date.
|
|
|
|
|
Not nearly innovative or witty enough to make it to my desktop. If there is a war, you missed it being new by about eight years. Also, the image doesn't reflect on any of the aspects of either programming language, any of their differences, or the people involved in the "war".
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|