|
i am using an oledbcommand object to perform both insert and update based on the command text supplied and i am adding the parameters for update also in the order of insert. So incase of update though, its not giving any error/exception but database is not getting updated.
Can any body pls tell me how to resolve this or any other way to implement both the functionalities using single method.
Thanks in advance.
|
|
|
|
|
You need to specify either the parameters by name ( in any order ), or pass them in the order that a stored proc you're calling requires them ( although I suspect you're using the nasty 'dynamic SQL in the presentation layer' stuff here )
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
thanks now its working (yes order mattered).
|
|
|
|
|
OleDb doesn't support named parameters. You have to specifiy them in the exact order they appear in the SQL statement. Well, you can give them names all you want, they won't do anything...
Yet another reason why I never use Access anymore.
|
|
|
|
|
I've found that naming them allows the use of a parameter value multiple times in the statement.
And is it an OleDb thing or a Jet Engine thing?
|
|
|
|
|
I never bothered to figure that one out. I'm guessing that since you can't do it in VA code in Access either that the "problem" would be tied to Jet, but I could be wrong.
|
|
|
|
|
hi everyone,
i have a picture box and i set pic's from database to it...bud the size of my images are bigger then the size of my picturebox...how can i fix this? what should i do to make the images programmaticaly smaller that they fix in the picturebox? thanx
|
|
|
|
|
Use The SizeMode Propertie
kobkob
|
|
|
|
|
Hi!
I have a property grid and I set to its SelectedObject an instance of a class. This class has some properties which I don't want to be displayed in the property grid. Is there an attribute to set before those properties to make PropertyGrid to ignore them?
Thanks,
Lukas
|
|
|
|
|
Check this[^] out.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
and if this is not enough (for example if you have no access to the source code of your target instance), you can define a Type descriptor that will filter the unwanted properties. See this article[^].
|
|
|
|
|
con.Open();
object[] objArrRestrict;
//select just TABLE in the Object array of restrictions.
//Remove TABLE and insert Null to see tables, views, and other objects.
objArrRestrict = new object[] {null, null, null, "TABLE"};
DataTable schemaTbl;
schemaTbl = con.GetOleDbSchemaTable(OleDbSchemaGuid.Tables,objArrRestrict);
// Display the table name from each row in the schema
foreach (DataRow row in schemaTbl.Rows)
{
listBox.Items.Add(row["TABLE_NAME"]);
}
instead of using list box,i want to add tables to tree veiw
what can i do???????????/
chanzeb chaudhary
|
|
|
|
|
use treeview1.nodes[0].add()....but a treeview can have child nodes recursively so how do you want to show the obtained rows in treeview ?
Koushik
|
|
|
|
|
int i = 0;
foreach (DataRow row in tbs.Rows)
{
treeVu1.Nodes[i].Add(row["TABLE_NAME"]);
i = i + 1;
}
But it does not work.
ERROR Message "Cannot apply indexing with [] to an expression of type 'method group"
|
|
|
|
|
hey use the following...
foreach (DataRow row in tbs.Rows)
{
treeVu1.Nodes.Add(row["TABLE_NAME"].ToString());
}
Koushik
|
|
|
|
|
|
hey guyz..im having a problem about my application, it has a profile form, with picture, this picture is being converted to bytes and save it to database, when the form loads, it will create a temporary file..and display the picture.. but the problem here is that, whenever i changed the picture of a certain profile, it will still displays the previous one, because the "file is being used". I can't see the effect, unless i stop the application and run it again.. i hope you can help me with this..tnx in advance
some codes:
strfn = AppDomain.CurrentDomain.BaseDirectory + "profile_pic\\" + dgProfile[dgProfile.CurrentRowIndex,0].ToString();
FileStream fs = new FileStream(strfn,FileMode.Create,FileAccess.Write);
fs.Write(imageByte,0,imageByte.Length);
fs.Flush();
fs.Close();
picBoxProfile.Image = Image.FromFile(strfn);
|
|
|
|
|
How do you read the bitmap ? If you pass the path to the constructor, this is what's holding the file open.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
Image.FromFile() is known to lock the file for as long as the image is alive;
I suggest you try and use Image.FromStream() instead. The stream you use can be
a FileStream, but it can also be a MemoryStream, so maybe you don't need a file at all.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hi all,
Is there any way, given an item in a dictionary D, to find its key(s), besides iterating through it? Would using another data structure helps if so which? (I seem to recall a solution for C++, but I can't definitely remember it and not sure if it applies to C#)
Thanks in advance!
|
|
|
|
|
You basically build two dictionaries, one in each direction. I think there are C++ classes that do a bidirectional hash table.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I am creating TabPages dynamically, adding a few textboxes, buttons etc.
I can't figure out though how to access these controls. I tried:
foreach (TabPage tp in tabControl1.TabPages)
{
foreach (Control c in tp)
{
if (c is CheckBox)
{
if (c.Enabled == true)
MessageBox.Show ("Enabled");
}
}
}
but get the error that TabPage does not contain a definition for GetEnumerator().
As the controls are created dynamically, I can't access them by name in the code.
Any ideas on how to access these controls?
-- modified at 4:06 Thursday 11th October, 2007
|
|
|
|
|
That sounds odd, I would have thought what you're doing is fine.
Try changing the outer loop from a foreach to a standard for loop. The implication is that the TabPages collection does not implement IEnumerable.
Regards,
Rob Philpott.
|
|
|
|
|
we can do like the following one...
foreach (TabPage tp in tabControl1.TabPages)
{
for (int i = 0; i < tp.Controls.Count;i++)
{
if (tp.Controls[0] is CheckBox)
{
if(((CheckBox)(tp.Controls[0])).Enabled)
MessageBox.Show ("Enabled");
}
}
}
Koushik
|
|
|
|
|
oh yes, just spotted it.
its this :
foreach (Control c in tp)
should be;
foreach (Control c in tp.Controls) or something like that. Can't remember what the collection is called.
Regards,
Rob Philpott.
|
|
|
|