|
hung1984 wrote: OleDbConnection aConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\db1.mdb");
cmd = "INSERT INTO Run(" + field + ") values (" + parameter + ")";
OleDbCommand sCommand = new OleDbCommand(cmd);
aConnection.Open();
Look at the error message again and read through the code. How is the command object going to know which connection object to use if you didn't tell it.
|
|
|
|
|
hung1984 wrote: OleDbConnection aConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\db1.mdb");
cmd = "INSERT INTO Run(" + field + ") values (" + parameter + ")";
OleDbCommand sCommand = new OleDbCommand(cmd);
add this
<br />
sCommand.Connection = aConnection;<br />
hope it helps
dhaim
ing ngarso sung tulodho, ing madyo mangun karso, tut wuri handayani. "Ki Hajar Dewantoro"
in the front line gave a lead, in the middle line build goodwill, in the behind give power support
|
|
|
|
|
thanks, but i have another error?
"No value given for one or more required parameters."
|
|
|
|
|
hung1984 wrote:
sCommand.Parameters.Add("@Site", OleDbType.VarChar, 20);
sCommand.Parameters.Add("@Model", OleDbType.VarChar, 20);
sCommand.Parameters["@Site"].Value = "site1";
sCommand.Parameters["@Model"].Value = "Model1";
try this :
sCommand.Parameters.Add("@Site", OleDbType.VarChar, 20).Value = "site1";
sCommand.Parameters.Add("@Model", OleDbType.VarChar, 20).Value = "Model1";
hope it helps
dhaim
ing ngarso sung tulodho, ing madyo mangun karso, tut wuri handayani. "Ki Hajar Dewantoro"
in the front line gave a lead, in the middle line build goodwill, in the behind give power support
|
|
|
|
|
thanks , but same error occured?
|
|
|
|
|
private void button1_Click(object sender, EventArgs e)
{
string cmd;
string field;
string parameter;
field = "Site,Model";
parameter = "@Site,@Model";
OleDbConnection aConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\db1.mdb");
cmd = "INSERT INTO Run(" + field + ") values (" + parameter + ")";
OleDbCommand sCommand = new OleDbCommand(cmd);
sCommand.Connection = aConnection;
aConnection.Open();
sCommand.Parameters.Add("@Site", OleDbType.VarChar, 20);
sCommand.Parameters.Add("@Model", OleDbType.VarChar, 20);
sCommand.Parameters["@Site"].Value = "site1";
sCommand.Parameters["@Model"].Value = "Model1";
OleDbDataReader aReader = sCommand.ExecuteReader();
sCommand.Parameters.Add("@Site", OleDbType.VarChar, 20);
sCommand.Parameters.Add("@Model", OleDbType.VarChar, 20);
sCommand.Parameters["@Site"].Value = "site1";
sCommand.Parameters["@Model"].Value = "Model1";
aReader.Close();
aConnection.Close();
}
|
|
|
|
|
just wrong code line position ,
thanks a lot
dhaim
ing ngarso sung tulodho, ing madyo mangun karso, tut wuri handayani. "Ki Hajar Dewantoro"
in the front line gave a lead, in the middle line build goodwill, in the behind give power support
|
|
|
|
|
hi to everyone.. anyone suggest me the method to read .mpp file content using C#. and also how we can store content to oracle database.
|
|
|
|
|
Does the office toolkit give you the ability to bridge to project ? If not, then you need to find out the file format and work out how to read it.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
In .NET 2.0, assume that I have some SQL written along the lines of:
Select child.name, parent.name
From person child, person parent
On child.ParentId = parent.Id
Where child.category = 55
I now have to convert this SQL so that it selects from a cached DataTable of people instead of directly from the database.
Is there an elegant way to convert this SQL using DataTable.Select (or some other DataTable method)? (I realize that if there was just one Person in the SQL statement this would be simple.)
|
|
|
|
|
If you've got relationships setup, you'll need to do something found at:
Select Statement Syntax[^]
Look for the section - "PARENT/CHILD RELATION REFERENCING"
|
|
|
|
|
I repeatedly am running into the same problem. I do scientific work where we use images, video, and sound files to record events. The time of the creation of the file is very important to us as often a file shows what happened at one moment in time and the next file shows what happened maybe only several seconds later. Since image files, video files, and sound files are all tagged with the date/time of their creation we have a record of when the file was created allowing us to make many observations as we know when the event happened. These files are created by many types of devices cameras, audio recorders, camcorders, etc. The problem I have is that when these files are copied the creation date becomes the date of the copy and the original “real” creation date is lost. Understanding this and I have resorted to using a drive mirroring pieces of software to copy my files from devices so the the “real” creation date is preserved as the date of the copy is of no importance to me.
I am looking for ideas about how to go about writing a C# program to copy files and preserve the “real” creation date/time.
|
|
|
|
|
Hi George,
I did tell you a couple of hours ago, modification datetime is the one to use.
In Windows creation time is when you create the container, not the contents;
modification time (or lastwrite time) is when you fill the container or in any way change the contents of the container.
So if you create a new document at 9 o'clock, edit it again at 10, and copy the file at 11 o'clock using Explorer, then the original will have created=9 modif=10, and the copy will have created=11 modif=10. So looking at modif time, they are the same; looking at creation time you would get confused indeed.
I set Windows Explorer to not show creation times and always show modification times.
So it will not confuse me, the datetime I see is about the content; I don't care about container times.
Of course, on top of the above, as you well know, some file types have a datetime information embedded in the data itself, such as the "picture taken" time inside a JPEG picture.
|
|
|
|
|
Hi guys I have noticed same result by trying two different approach.
1). I am simply opening a myfile.html inside a windows form and viewing it through the PrintPrviewDialog. What i have noticed is that if i change the text to some lite blue colour when i do a print preivew the colour isn't the same. It's blue but little dark. I am wondering if this is the default behaviour or is there any possible solution around to it. Has anyone ever noticed that.
2). simply open a html file inside a internet explorer having lite text colour. Do a print preview and u will colour aren't same.
What can be done to get the same colour while print previewing
Thanks in advance
|
|
|
|
|
Maybe something to do with web safe colors? Perhaps you should ask in a different forum. Not sure C# people can help
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
I have a large .net application (.net 2.0). It runs smoothly under win 2000 and xp sp2. But it will hang under win XP SP3 and vista once it is idled for 20 minutes.
Does anyone know what is the potential problem?
Also is there any good way to find out what cause the problem under vista?
|
|
|
|
|
It's called "the debugger".
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Sincerely Samer Abu Rabie
Note: Please remember to rate this post to help others whom reading it.
|
|
|
|
|
Don't cross post.
"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
|
|
|
|
|
Maybe something is being garbage-collected?
|
|
|
|
|
(his application?)
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
hey,
two weeks ago i found this code:
HTMLDocument myDoc = new HTMLDocumentClass();
myDoc = (HTMLDocument)ie.Document;
// a quick look at the google html source reveals:
// <INPUT maxLength="256" size="55" name="q">
//
HTMLInputElement otxtSearchBox = (HTMLInputElement)myDoc.all.item("username", 0);
otxtSearchBox.value = "??????????";
HTMLInputElement otxtSearchBox2 = (HTMLInputElement)myDoc.all.item("password",0);
otxtSearchBox2.value = ""??????????";";
HTMLInputElement btnSearch = (HTMLInputElement)myDoc.all.item("oSubmit", 0);
btnSearch.click();
so I wanted to add a little gadget which checks if i got new mails.
So i found the HTTPWEBREQUEST consept :
HttpWebRequest request = (HttpWebRequest)
WebRequest.Create("http://newmail.walla.co.il/");
// execute the request
HttpWebResponse response = (HttpWebResponse)
request.GetResponse();
// we will read data via the response stream
Stream resStream = response.GetResponseStream();
The PROBLEM is I can't get into my mail with HTTPWEBREQUEST because it sends me to the login page.
The login page ,as long as i know uses GET method and i can't find a way to pass trough.
could someone help me somehow ? how can i fill these fields?
i was looking for the answers like 4 hours , trying changing cookies , NetworkCredential, Headers ,WSSE ..... with no success( i just don't know what to do)..
|
|
|
|
|
Go easy on the bold face text, please.
"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
|
|
|
|
|
|
After login, you get the cookie back. Save the cookie and use it in the new request. This often contains the login info.
|
|
|
|