|
Hello Sir,
I Fill The DataSet From A XML file like
ds.ReadXml(@"C:\myXmFile.xml");
The DataSet Is Filled and Data comes to the ds.tables[0]....
Now I Want to edit Some Rows of This DataTable .. For That I set the
PK for the table like
//Setting PK
DataColumn[] colPk = new DataColumn[1];
colPk[0] = ds.Tables[0].Columns["StoreID"];
ds.Tables[0].PrimaryKey = colPk;
//End Setting PK
After that i filter the data using this primary key like....
DataRow[] customerRow = ds.Tables[0].Select("StoreID = 1");
that means customerRow is the collection of all the filtered data of StoreID =1
if i want to edit its content i have to use this
customerRow[0]["StoreName"] = "Updated Company Name";
customerRow[0]["storeAddress"] = "Seattle";
my Problem is Begin From Here...
1. this is hard coded for the 0th index of datarow.
2. What happned if multiple rows are return how I can change them...? single row and multiple too?
3. How i Can update the updated Datarow to My Table..? also same case of multiple updated rows
4. after all manipulation upadate the data to actual database
I think last question should solved by
myDataAdapter.update(ds);
Please Help Me
Regards
Pankaj Joshi
|
|
|
|
|
Hi all
On my project I have created a connection and have retrieved some data from the database by using a stored proc. Here is the code:
string cnString = "Data Source=localhost;Initial Catalog=Northwind;User Id=MyName;Password=MyPassword";
SqlConnection cn = new SqlConnection(cnString);
SqlCommand cmd = new SqlCommand("sp_Products", cn);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds,"Products");
The database is now storing in my dataset. But how can I send it to display on my reportviewer by using crystal report that comes with visual studio?
Thanks advance
|
|
|
|
|
hello...help me please!!!!!!!!!!!!!!!
i'm waiting for your answers.............
|
|
|
|
|
A message like this is considered rude.
______________________
stuff + cats = awesome
|
|
|
|
|
Hello All,
I'm getting a basic Windows application going in C# using Visual Studio 2005 Express and SQL Server Express.
I've created a database (SQL Server Compact) and added a table, a column and some records.
The DB is on my box, XP Home.
I want to populate a ListBox with the four CUST_NAME records in the Form.
Box name: MAXPHOME
SQL Server: SQLEXPRESS
DB Name: OMA1
DB file: OMA1.sdf
Table in DB: CUSTOMER
Columns in CUSTOMER: CUST_PK, CUST_NAME
User Name: none
Password: none
I need a few pieces of code.
1 - DataBase connection string.
2 - Syntax to send the SQL ("SELECT * FROM CUSTOMER").
3 - Databinding the DB return to a windows control (ListBox, DropDown, TextBox) in a Windows Form.
I got some pieces of code from this site, I'm close but, I just can't get it....
Thanks,
Pat G.
|
|
|
|
|
|
pgiambat wrote: 1 - DataBase connection string.
using System.Data.SqlClient;
...
SqlConnection oSQLConn = new SqlConnection();
oSQLConn.ConnectionString = "Data Source=(local);" +
"Initial Catalog=mySQLServerDBName;" +
"Integrated Security=SSPI";
oSQLConn.Open();
pgiambat wrote: 2 - Syntax to send the SQL ("SELECT * FROM CUSTOMER").
Yes that is correct.
pgiambat wrote: 3 - Databinding the DB return to a windows control (ListBox, DropDown, TextBox) in a Windows Form.
Get it[^]
Regards,
Satips.
|
|
|
|
|
Satips wrote: ...oSQLConn.ConnectionString = "Data Source=(local);..." +
This won't work.
You missed the part about SQL Server Compact Edition.
only two letters away from being an asset
|
|
|
|
|
Howdy fellow geeks,
This is just a sort of general C# question that doesn't really require a solution as there's many ways to work around, I'm just wondering.
Is it possible in C# (.NET 2.0) to define a get/set for a property with different access modifier for the get and the set.
That is, something like that:
private string _Prop;
public string Prop
{
get
{
return _Prop;
}
}
protected string Prop
{
set
{
_Prop=value;
}
}
Obviously that doesn't work or I wouldn't ask the question but maybe there's a different syntax to do so.. is there?
(while retaining the neatness of get/sets)
Cheers
Ben
|
|
|
|
|
Hope Salil Pitkar here[^] gives a nice explanation for your Question.
Regards,
Satips.
|
|
|
|
|
Well, actually, yes it did, thanks!
The solution is in the comments at the end. Though I think the syntax extension suggested in the article itself is still interesting.
Cheers
Ben
|
|
|
|
|
Glad to help always.
Regards,
Satips.
|
|
|
|
|
I am lokking for an article about micro contoroler?
Please give me some article about it.
thanks
|
|
|
|
|
Hope this[^] may Help you.
Regards,
Satips.
|
|
|
|
|
Does anyone know where I could find some good documentation on the WAV file format? A lot of what I've found is sort of hard to understand.
P.S. Sorry if this isn't the right board to post this question; I couldn't find a specific board related to file formats, audio, etc, and I usually ask questions here, so...
-----
Note: *** Never give me an answer have anything to do with Visual Studio. I don't have this program, and it'll be that way for a long, long time. ***
|
|
|
|
|
|
I have a main window application, mainForm.
At some point, I create an auxhiliary window, auxWin.
For auxWin, rather than disposing the object when user closes the window (clicks the x in top right), I want to hide the object instead (and simply show it when the user opens it again).
I kind of got close by intercepting the FormClosing event with the following:
<br />
<br />
private void CatchFormClose(object sender, FormClosingEventArgs e)<br />
{<br />
this.Hide();<br />
e.Cancel = true;<br />
<br />
}<br />
<br />
where e.Cancel stops the system from disposing the window.
This works fine, but the problem comes in when I try to close the main application, mainForm - it now 'hides' it too! (in effect nothing happens, which is bad since I want it to close!). I put a breakpoint at this.Hide() and it gets called which is surprising (even though this event-handling method is in auxForm ??). I have tried doing a check with:
<br />
if(sender.GetType() == typeof(auxForm))<br />
but this doesn't work - it ALWAYS thinks its the auxForm that raised the event.
Am I going about this the right way? If someone could point me in the direction of how windows forms (and their opening and closing, without disposing objects - which I understand is bad for memory usage too) are managed I'd greatly appreciate it!
Many thanks,
Gerry
Forms newbie
|
|
|
|
|
Hello,
Sounds strange to me!
I think you have to show some more code.
All the best,
Martin
|
|
|
|
|
Thanks for your response Martin...
Which part of the code don't you understand?
It basically comes down to how does one hide a form (ie. override the Close() / Dispose() method) yet keep the main form reactive to closeForm events ??
Regards,
Gerry
|
|
|
|
|
Hello,
I did understand what you meant!
As I said "It sounds strange to me", I meant the behaviour you discriped.
So I'm thinking there must be something else wrong.
Maybe seeing the code helps us, to help you better.
All the best,
Martin
|
|
|
|
|
I've created an application for logging various events in an RTF textbox with lots of formatted text and graphics etc.
Now I'd like to be able to print the contents.
But! I can't find any simple way to do this...
One solution I've found saves the contents to disk as a .rtf document and then gets wordpad to print it. This works and produces very nice output - however wordpad doesn't support headers and footers and I really need to add date and timestamps plus page numbers to the bottom of each page.
Does anyone know of a simple way, or a good resource which describes how to print the contents of an RTF textbox?
Many thanks for your kind help.
John.
|
|
|
|
|
Take a look here[^] for a start.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Mav,
Very cool article - just what I need methinks.
I'm going to have to read it a couple of times to make sure I understand it though!
Many thanks.
John.
|
|
|
|
|
hi
i need a DataGridView with footer, but i don't found on the net, can any one help me ?
thanks
|
|
|
|
|
Hi,
If you Want To Add Footer in DataGridView, For that one method may be
loop through the available rows and add the values and displaye them like
double amount=0;
int i=0;
for(i=0; i< dgv.rows.count-1;i++)
{
amount+=Convert.ToDouble(dgv.rows[i].cells[0].ToString());
}
dgv.Rows.Add();
dgv.Rows[i+1].Cells[0].Value=amount.ToString();
Hope This Hepls
Regards
Pankaj Joshi
|
|
|
|