|
Your objectdatasource needs to have a update method that has the parameters that you see in the error. IN that method you should run a sql statement that updates the sql database. You perhaps have put an update method in your objectdatasource definition, but it probably doesn't match the one defined in the error. NOTE the columns are auto generated based off the columns in the gridview.
Hope that helps.
Ben
|
|
|
|
|
But why in the wizzard I see for SELECT, INSERT, UPDATE and DELETE a method. See it here:
click here
|
|
|
|
|
Hello all. I have a datagridview (genericGrid) and a bindingsource (genericBS). genericGrid's datasource is genericBS. I want to programmatically switch genericBS's DataSource and Datamember. Then, display those values on the genericGrid.
What I've tried:
Using a switch statement to change genericBS's DataSource and DataMember properties on the load. Then, called genericBS.ResetBinding(true). This is supposed to force genericGrid to refresh its rows. Amazingly, it doesn't work.
What actually works:
I've resorted to creating a bindingsource for each table. Then using a switch statement to change genericGrid.DataSource. This works.
But, there has to be a way to use just one bindingsource, right? Any suggestions?
Lester
http://www.lestersconyers.com
|
|
|
|
|
Got an enum. Got 2 get methods for it. One returns the instance of the enum itself, one intends to return the int used in the enum.
public enum elementTypes
{
normalText = 0,
hidden = 1,
programData = 2,
}
There are more but this is an idea.
As I said I'd like to be able to get the actual number, not the name or an instance.
Ninja (the Nerd)
Confused? You will be...
|
|
|
|
|
The only way I know of doing this is:
elementTypes et;
//This will give you the number
(Int32)et.hidden;
Hope that helps.
Ben
|
|
|
|
|
Fantastic.
Out of lack of skills, what the heck does the (Int32) prefix do? Is it some sort of implicit conversion?
Ninja (the Nerd)
Confused? You will be...
|
|
|
|
|
Right. It casts the Enum as a number. It is kind of silly, but it the only way I know of to get the enums numerical value. I am sure someone else will post a different way of doing it, but that is the way I normally do it.
Ben
|
|
|
|
|
OK...
Thanks.
Ninja (the Nerd)
Confused? You will be...
|
|
|
|
|
Yeah here's another way:
int number = enum as int;
XD
My current favourite word is: Waffle
Cheese is still good though.
|
|
|
|
|
The Undefeated wrote: int number = enum as int;
that will not be accepted, for one "as" requires a reference type, not a value type.
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
|
|
|
|
|
*shakes fist angrily at Luc*
You ruin everything
int Waffle(ref Enum myEnum)
{
return myEnum as int;
}
My current favourite word is: Waffle
Cheese is still good though.
|
|
|
|
|
no no.
Error: The as operator must be used with a reference type ('int' is a value type)
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
|
|
|
|
|
*cries*
Perhaps if i actually tried to use the code before i posted it.
*cries some more*
My current favourite word is: Waffle
Cheese is still good though.
|
|
|
|
|
Yeah, the sensible sequence is:
- try to understand the problem at hand
- read the documentation
- try a couple of things
- search for a solution for the remaining problems
- only then post at CodeProject
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
|
|
|
|
|
Ninja-the-Nerd wrote: what the heck does the (Int32) prefix do? Is it some sort of implicit conversion?
No, it's an explicit conversion.
An implicit conversion is when the conversion is done without specifying the data type, this is allowed when widening types, like from a byte to an int. Example:
byte data = 42;<br />
int moreData = data;
An explicit conversion is when you specify the data type. This is used to tell the compiler that you want the conversion eventhough the compiler doesn't know if it will always work, or when an implicit conversion isn't allowed, like with an enum. Example:
int data = 42;<br />
byte lessData = (byte)data;
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
I think a slightly better solution in this case is to use the int type rather than the Int32 object.
I have not really used the Int32 object but I assume that it acts in the same way as other objects in that it passes itself by reference instead of value. This may then catch out other developers who are used to integers being value types and not objects.
Instead use:
<br />
TestEnum te = new TestEnum();<br />
<br />
int enumNumber = (int) te;
Hope this helps.
|
|
|
|
|
MCEdwards wrote: I think a slightly better solution in this case is to use the int type rather than the Int32 object.
There is no difference.
MCEdwards wrote: I have not really used the Int32 object
Yes, you have. The int keyword is an alias for the System.Int32 data type.
MCEdwards wrote: I assume that it acts in the same way as other objects in that it passes itself by reference instead of value.
Assume away...
Int32 is a structure, not a class, so it's a value type, not a reference type.
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
I have dataset that the row count of that dataset is more than 2 lackh. ijn waht way should i split my large dataset into two data set.
Yogesh Pekhale
pekhaleyogesh@gmail.com
|
|
|
|
|
You have to split the dataset? Can't you create instead two from origin? It would be better... Now, the first thing coming into my head is make a select on datatable to get few rows...
Visit my blog at http://dotnetforeveryone.blogspot.com
|
|
|
|
|
I want to display the values of Application variable of ASP.NET webpage into window application's listView control when I send httpRequest to that page.
|
|
|
|
|
hello sir,
I have a problem while developing an appliation in which i have to send http request to server and then receive response from server
please help me
|
|
|
|
|
|
Does this[^] article help?
/ravi
|
|
|
|
|
I .Net Framework 2 there is a very useful calls called the System.Net.WebClient class. This class contains methods that allow you to quickly make http and https requests and process the return. You can set headers and post information. I have used it to create a http post to remote servers and receive a response. Here is some code:
<br />
Byte [] PostData = System.Text.Encoding.ASCII.GetBytes("hello world");<br />
System.Net.WebClient client = new System.Net.WebClient();<br />
Byte[] Response = oClient.UploadData("http://www.somewhereintheworld.com", "POST", PostData);<br />
return System.Text.Encoding.ASCII.GetString(Response);<br />
These first line just turns the post data I want to send into a byte array. I create the WebClient object on the second line and then on the third line I tell the client to send the data to the target website as a post action with the byte array I have created. This returns a byte array that I then need to turn back into a string which is done on the last line.
Happy browsing.
|
|
|
|
|
Hello!!
I want to convert .bmp image to Jpeg image in C#. so kindly help me out.
thx
B!z
|
|
|
|