|
I'll guess the query will be ok ( but i don't have qoutes around the fieldnames) and yes the question is replaced by the given parameter value.
Maybe better to define your own query and use less fields in the where clause.
try this :
Tmp_datatable = yourdatatable.getchanges();
this.Adapter.Update(Tmp_datatable);
Tmp_datatable only has the modified rows
greetz.
|
|
|
|
|
Hi,
I put the code inside and also debug them, looks like your sample;
try<br />
{<br />
if (this.Validate() == false){<br />
MessageBox.Show("Validation is false verify your input!");<br />
return;<br />
}<br />
this.devicesBindingSource.EndEdit();<br />
VideoStreamsDataSet.DevicesDataTable Tmp_datatable = new VideoStreamsDataSet.DevicesDataTable();<br />
Tmp_datatable = VideoStreamsDataSet.DevicesDataTable)this.videoStreamsDataSet.Devices.GetChanges();<br />
this.devicesTableAdapter.Update(Tmp_datatable);<br />
MessageBox.Show("Update successful");<br />
}<br />
catch (System.Exception ex){<br />
MessageBox.Show("Update failed");<br />
}
If I add a new row the values will update and displayed at the DataGridView. But also if I close the application and restart, I could see the data isn't stored at database.
If I modify a row so I catch an exeption calling me this:
Parallelitätsverletzung : Der UpdateCommand hat sich auf 0 der erwarteten 1 Datensätze ausgewirkt.
means:
parallel violation: The UpdateCommand has got 0 of expected 1 data record affected.
Did you have some idea or maybe some complete smale sample that's works correct. I'm much more than frustrated.
Thanks alex
|
|
|
|
|
concerning the update is suggest not to use the cmdbuilder but do it yourself. it takes a little more time but your sure it's the way you want it..
just do the update using the key fields in the where clause..
Also autonumbering and datetime fields can cause problems in the where clause.
example :
WagonsAdapter.UpdateCommand = new OleDbCommand();
WagonsAdapter.UpdateCommand.Connection = connection;
WagonsAdapter.UpdateCommand.CommandText = "UPDATE Wagons SET Wag_Name = ?, Wag_Tag1 = ?, Wag_Tag2 = ?, Wag_Info = ?, Wag_Date = ?, Wag_Active = ?, Wag_RecordStatus = ? WHERE Wag_ID = ?";
WagonsAdapter.UpdateCommand.Parameters.Add("Name", OleDbType.VarWChar, 0, "Wag_Name");
WagonsAdapter.UpdateCommand.Parameters.Add("Tag1", OleDbType.Integer, 0, "Wag_Tag1");
WagonsAdapter.UpdateCommand.Parameters.Add("Tag2", OleDbType.Integer, 0, "Wag_Tag2");
WagonsAdapter.UpdateCommand.Parameters.Add("Info", OleDbType.VarWChar, 0, "Wag_Info");
WagonsAdapter.UpdateCommand.Parameters.Add("Date", OleDbType.Date, 0, "Wag_Date");
WagonsAdapter.UpdateCommand.Parameters.Add("Active", OleDbType.Boolean, 0, "Wag_Active");
WagonsAdapter.UpdateCommand.Parameters.Add("RecordStatus", OleDbType.Integer, 0, "Wag_RecordStatus");
WagonsAdapter.UpdateCommand.Parameters.Add("ID", OleDbType.Integer, 0, "Wag_ID");
this works fine... i also had the same problem using the cmdbuilder..
greetz.
|
|
|
|
|
Hi Kurt,
sorry stop here. I found the error, it's always the user.
I discovered there more than one databasefile inside my project. And then I detect that the VisualStudio2005 always copy the original file into the /bin/debug diretory on program start. That's the explanation why always the new data was lost after program start.
I disable that feature on my project settings now.
Sorry that I dissipate your time for this little mistake.
So thanks a lot for your support.
greets alex
|
|
|
|
|
Hi All,
My app is crashing with a C++ exception (even though it's c# 2.0)
First-chance exception at 0x7c812a5b in HDCapture.exe: Microsoft C++ exception: EEException at memory location 0x03c7f368..
I cannot find anything about what this exception means in msdn, or even googling for it.
Does anyone have any ideas?
It's thrown when one thread interrupts another thread which is in a Thread.Sleep(Timeout.Infinite). The code pointer is on the Thread.sleep line.
I'm really stuck for how to diagnose this.
Thanks
Jon
|
|
|
|
|
Sounds like you're using a C++ component ( such as DirectX ) and it's what is crashing.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Indeed I am - directshow. But i'm using directshow.net. Also, i've got a reference to a C++/CLI assembly too.
Any pointers on what the exception means?
|
|
|
|
|
OK, if the C++/CLI assembly is your own, put some break points in it. Sorry, I have no idea what the problem is, just that that's the probable cause.
Jon Hulatt wrote: But i'm using directshow.net.
Doesn't matter, that's just a wrapper.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
hi
how can i protect my dll from giving out the source code. As there are many free tools that can generate whole code.So how is my dll secure.
I donot want to obfuscate the code to look unreadle but i want it not to be opened at all. It seems it can be done by removing the CLI header. How can i do that if possible.
regards.
|
|
|
|
|
|
hi
I have wriiten my own obfuscator but that can be open back also. So i want something so that our dll is secured to open in any tools.
thanks.
|
|
|
|
|
Hi,
I need to manipulate the 'SortedArray' class in .net so that it allows the entry of the same key more than once. At the same time, it should have all the other properties and methods as it had before. This is crucial to my project.
I am totally unfamiliar with overriding the base classes to produce this kind of desired functionality.
Could you spare some of your precious time to help me out with the problem ?
-Sreerag
|
|
|
|
|
I suspect you'd do better to take another container class, and either make it sorted, or simply sort it every time you add an item. I suspect that the requirement of items being unique is an assumption that could cause you grief in a lot of places within the class.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi all,
I have this bug where my main Form is getting set to WS_DISABLED somtimes and I don't know how it is happening since I am never explicitly doing this in my code (or at least not that I am aware of).
To make matters worse the Window Style event is never called for WS_DISABLED!
Does anyone have an idea how I can track what (object or other) is setting WS_DISABLED on my main Form?
It seems to be happening sometimes after I open and close a MessageBox, but the behavior is completely random. Sometimes the form locks up and sometimes it does not. Using Winspector I am able to change the window style to "re-enable" it and I am keeps running fine again.
Kind thanks,
Serge
|
|
|
|
|
How can i get the names of the tables in a database using System.Data.Odbc
sAqIb
|
|
|
|
|
select * from INFORMATION_SCHEMA.TABLES
|
|
|
|
|
can i use the same query to get the tables from a specific database e.g. from northwind
sAqIb
|
|
|
|
|
try
use northwind<br />
select * from INFORMATION_SCHEMA.TABLES
|
|
|
|
|
i tried above query, its working fine for sql server. But i also want to get the list of tables from other databases like oracle, mysql, ms access.
isn't there any single query which can get the list of all tables from any database?
sAqIb
|
|
|
|
|
I want to only int in text control how this can happen;
|
|
|
|
|
In case you use .Net 2.0 you can use the MaskedTextBox control.
Otherwise take a look at the following example copied from the MSDN topic of KeyPress event:
private bool nonNumberEntered = false;
private void textBox1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
nonNumberEntered = false;
if (e.KeyCode < Keys.D0 || e.KeyCode > Keys.D9)
{
if (e.KeyCode < Keys.NumPad0 || e.KeyCode > Keys.NumPad9)
{
if(e.KeyCode != Keys.Back)
{
nonNumberEntered = true;
}
}
}
}
private void textBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if (nonNumberEntered == true)
{
e.Handled = true;
}
}
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hi,
How can i get the path of the selected item from the listview.
Thanks In Advance.
Ravi
|
|
|
|
|
|
Hi,
i hace displayed the selected tree view node items in the list view control and upon selecting the item
i need to get the path of the item so that on clicking that item i should repopulate the listview with selected directory items.
Thanks
Ravi
|
|
|
|
|
In a DataGridViewComboBoxColumn I can get everything set up fine with the DisplayMember as one column of a DataTable.
Since the DataTable contains separate columns for firstname and lastname, and I'd like both displayed in the list, is there a way to set the DisplayMember property to show a combination of data columns (e.g. lastname + ", " + firstname)?
Or, am I going to have to perform the concatenation in some other part of the application/database?
|
|
|
|