|
Member 7697943 wrote: But after running the code I do not see the changes in the database.
Their might be lots of problem. Without seeing your Db update code,
No one can help.
a) You are not even interacting with DB !
b) Query for update is wrong !
etc etc...
download MSDN sample you had mentioned in your post.
try to play/explore with it then imply/mimic the same in your app.
|
|
|
|
|
Without seeing the code which you used to add the new row, it is impossible to guess...
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
|
|
|
|
|
Problem is you are editing record only on UI not in DB.
You have to Update that change in DB. With DataAdapter object you can update that, like
this.TableAdapter.Update(this.NwindDataSet.CustomersRow);
Refer to this for more help.
Hope this help(if yes then please vote )
|
|
|
|
|
i have a textbox in form1,
i want send the information of textbox to combobox in form2 ???
how i can???
help me please
modified on Saturday, February 26, 2011 4:26 PM
|
|
|
|
|
Read This. It will help !
And is correct approach.
Other approach (if small interaction is involved)
form2 obj = new form2(textBox.text);
obj.Show();
public form2(string text)
{
InitializeComponent();
combobox.Items.Add(text);
}
|
|
|
|
|
Thanks!
|
|
|
|
|
hanis29268 wrote: i want send the information of textbox to combobox in form2?
What's wrong with using a simple assignment statement?
I must get a clever new signature for 2011.
|
|
|
|
|
You missed the bit where he said "Form1" and "Form2" then?
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
|
|
|
|
|
No, I just think questions like this are so basic that questioners should be able to work it out for themselves. After all they are just about moving a field or property from one object to another.
I must get a clever new signature for 2011.
|
|
|
|
|
I know what you mean, but the concept of private vs public does seem to confuse beginners: perhaps it should be introduced earlier in the courses? Along with decent naming, commenting, what an instance is, why not to use static, etc. , etc., etc.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
|
|
|
|
|
Hi
I'm using the WIA Library 2.0 from the Microsoft website to scan multiple pages. I then convert these scanned images to byte arrays and keep them in a List<byte[]>. My next goal is to combine these images/byte arrays and save it as 1 single file. I would prefer saving it as PDF, but TIFF will also do for multiple pages. I had a look at the Codeproject article on how to use the Ghostscript API, but I`m looking for a simpler way.. preferably without using third-party tools.
Any hints would be appreciated
Thanks
|
|
|
|
|
I came across this the other day while trying to convert Byte Arrays stored in a database back into Tiff files. Create Tiff Image Page By Page[^] Maybe it could help you.
Happy coding.
|
|
|
|
|
|
Great link, thanks.
|
|
|
|
|
Nice Link it help me also
|
|
|
|
|
Would anyone care to point out to me what the main differences between SqlDataReader and SqlDataAdapter are, when to use one and when to use the other?
I've been using SqlDataReader exclusively so far and have not yet even bothered to read what SqlDataAdapter really is about.
|
|
|
|
|
The big difference is time.
When you use a SqlDataReader, you open a connection, start reading, then loop though each record, processing it. When you have finished, you close the database connection.
When you use a SqlDataAdapter, it opens the connection, takes a snapshot of the database, and closes the connection. You can then process the records.
You can use a DataAdapter to bind a data source to a control, such as a DataGridView, rather than iterating though each record.
Have a look on Google: "SqlDataReader vs. SqlDataAdapter" will give you a lot of hits, most of which are pretty useful.
(And yes, I do know that a SqlDataAdapter leaves the connection open if it was already - that's the advanced course, ok?)
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
|
|
|
|
|
OK thanks, that helps. As regards databinding, I've always used SqlDataReader , even for that, like so:
using (SqlDataReader mySqlDataReader = mySqlCommand.ExecuteReader())
{
DataSet myDataSet = new DataSet();
DataTable myDataTable = new DataTable();
myDataSet.Tables.Add(myDataTable);
myDataSet.Load(mySqlDataReader, LoadOption.PreserveChanges, myDataSource.Tables[0]);
myDataGridView.DataSource = myDataSource.Tables[0];
}
Do you know of any advantage over this by rather using a SqlDataAdapter ? How would you do that?
|
|
|
|
|
I wouldn't even use a DataSet like that, I define and fill DataTables myself. This[^] article shows how.
|
|
|
|
|
Thanks, it looks interesting, but jeeeez, it looks complicated. I'll go through it more attentively when I have a little more time but, briefly, could you explain why that method is better than using a DataSet like in my earlier example?
|
|
|
|
|
I personally like to stick to DataReaders and convert the data into proper CLR objects, rather than binding directly to a DataAdapter. Especially when it comes to WPF applications, as then you can have all the proper interfaces such as IDataErrorInfo and INotifyPropertyChanged which makes Databinding and Validation much easier. I have heard arguments for DataAdapters before but never used them. Just my 2c.
|
|
|
|
|
I always use a DataReader, never a DataAdapter or DataSet. In my opinion, DataAdapters, DataSets, and DataGrids were developed to allow Microsoft presenters to very quickly query, display, and update simple data and get an "oooh" from the crowd. They are fine for prototyping, but are not suitable for production enterprise applications. DataAdapters are very limited in what they can do and actually try to do too much -- e.g. optimistic concurrency[^].
The few times I've been lazy and used a DataAdapter in a real scenario, it bit me and I had to rework the code to use a DataReader instead.
Also, bear in mind that in ADO.net, all data access goes through a DataReader -- ExecuteScalar, ExecuteNonQuery, DataAdapter.Fill, and DataAdapter.Update all use ExecuteReader to perform the tasks.
ExecuteReader can be used to execute any SQL statement your database accepts -- queries, DML, and DDL. And, in some cases (SQL Server) you can pass a semi-colon delimited list of SQL Statements (though it doesn't report the results of non-queries the way I'd like ).
By using a DataReader you can reduce your application's memory footprint when you don't need to have all the records in memory at the same time. Or you can fill a collection of custom objects rather than a DataTable. Or you can fill a DataTable your own way and avoid the DataAdapter's overhead.
DataGrids and DataGridViews are rarely an appropriate control for displaying and editing data in real situations.
|
|
|
|
|
Hi Everybody
We have one Asp.net application developed using framework 2.0 with C#,Sql and AJAX. The application is running live from past 2 years almost. All the times users will be facing kind of strange problem, reporting some junk data will be displayed on the browser some times. When they refresh the page or reopen the browser, it will display the correct information.
For Eg. We have a stored procedure which returns months between 2 dates, if we pass 2 dates as '01/04/2010' and '30/06/2010' then procedure will return 'APR,MAY,JUN'.
One case we have noticed where it has returned and displayed as MAY,JUN,JUL,AUG which is not possible. Once we refresh or reopen the page it displays the correct information.
This is one ex. whereas we have some other page also where we get unwanted values like that.
If any one has come across such scenario ever, let me know what could be the problem and solution for this.
|
|
|
|
|
devkranth wrote: which is not possible.
Well, it evidently is possible...
Are you saying that it is data returned from this SP that is apparently wrong - or are their other areas on the page that may be wrong?
It sounds to me like a caching issue, maybe? Like, maybe an earlier call to the SP returned the May_Aug list and it is being displayed from a cache?
Using Ajax I have had situations where the customer shows me screens which show incorrect data - which turns out to be something that hasn't finished refreshing through an Ajax call; in this instance I changed the display to be hidden while updating, so it was clear what was happening when the Ajax call was slow.
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
Thanks Maxxx
Yes, there could be other area on the page also where it is possible.
There is no possiblity of SP returning May_Aug through earlier call as there is no pro data available for this. Only APR-JUN , APR-SEP or JAN-MAR is possible.
For this particular page as it is being used for printing information we have not used AJAX.This problem is reported by the user rarely so it is very difficult to trace out.
The doubt what i have..Can sql responce be modified through network or any other source?
|
|
|
|