|
what the function to get the name of the node itself ( Request)?
<request num_param="0" bytecount="0">
|
|
|
|
|
hung1984 wrote: what the function to get the name of the node itself ( Request)?
The Name of the node? Could that be what the Name[^] property is for?
|
|
|
|
|
I have 1 xml file :
<myxml>
<common>
<number a="0" des="int">
<number a="1" des="doub">
i want to get value of "a" and "des" node, my code below get wrong?
XmlDocument Reader = new XmlDocument();
Reader.Load("MyXml.xml");
XmlNodeList List = Reader.SelectNodes("/MyXml/common/Number");
foreach (XmlNode node in List)
{
int i = int.Parse(node["a"].InnerText);
des[i]= node["des"].InnerText;
}
thanks
|
|
|
|
|
If you are going to include XML in your post either manually escape the XML characters or check the "Ignore HTML tags in this message (good for code snippets)" box for the post (below the smilies and above the submit button)
If you are using .NET 3.5 there are new and better classes for querying XML.
|
|
|
|
|
If node a and des have attribute called "name" then you can get the value of that attribute by following
foreach (XmlNode node in List)
{
int i = int.Parse(node["a"].Attributes["name"].Value;);
des[i]= node["des"].Attributes["name"].Value;
}
|
|
|
|
|
Hi
I want to do a project where I need to calculate the intersection of the two cubes but I don't now how i can calculate the volume of this intersection. This is the project
Create a small web application that allows a user to enter the dimensions and coordinates of two cubic objects in a 3-dimensional space. Once the information has been entered, the web application should calculate if the two cubes intersect, and if so, what the volume of the shared space is.
Note, the coordinates specify the CENTER of the cube!
Sample Data:
Cube A: Size = 5m x = 10m
y = 10m
z = 0
Cube B: Size = 2m x = 9m
y = 9m
z = 1m
Answer: Do the cubes intersect? What is the volume of the shared space?
|
|
|
|
|
Guys,
I am trying to save the hidden panel contents to an image using GDI+.
I do not want to resize the panel to show all the contents and then save it.
I would like to keep the panel at the default size and save all the hidden contents without scrolling.
Thx.
|
|
|
|
|
Image image = this.panel1.BackgroundImage;
image.Save("1.jpg");
Tan Li
I Love KongFu~
|
|
|
|
|
Thx for the response.
The contents on my panel are custom drawn items. I would to save everything (hidden items as well) to a image file without scrolling or resizing the panel.
|
|
|
|
|
Well, about this, I do not know how to save the graphic objects into a file directly. However, you can save a image through Bitmap. Such as:
Bitmap bitmap = new Bitmap(400,400);
Graphics g = Graphics.FromImage(bitmap);
Pen pen = new Pen(Color.Black);
g.DrawEllipse(pen, new Rectangle(10, 10, 200, 200));
bitmap.Save("test.jpg");
Hope this will help you~
Tan Li
I Love KongFu~
|
|
|
|
|
Hi,
I have Form app that includes a DataGridView control (bound to DataTable). The user can sort the columns by clicking the column headers.
If the user has clicked the Date header (to sort the column), the code below fails to update all rows in the DataGridView (and Database). The list is fairly large (few hundred), so I can only guess that when a certain number of rows are updated (via - row.Cells["Col_ItemAddedDate"].Value = newItemDate;) a resort occurs that mucks up the foreach loop? If I don't update the DGV cell, the loop works fine to update database.
foreach (DataGridViewRow row in dataGridView1.SelectedRows)
{
OleDbCommand myCommand = new OleDbCommand("UPDATE Products SET ItemAddedDate=? WHERE ItemID=?", myConnection);
myCommand.Parameters.Add("@ItemAddedDate", OleDbType.Date).Value = newItemDate;
myCommand.Parameters.Add("@ItemID", OleDbType.BigInt).Value = row.Cells["ItemID"].Value;
// execute the command
myCommand.ExecuteNonQuery();
// THIS CODE CAUSES THE LOOP TO FAIL (if the Col_ItemAddedDate column header is clicked to sort)
// Some of the rows are updated, but some do not (both Database UPDATE and the DGV cell update will fail)
row.Cells["Col_ItemAddedDate"].Value = newItemDate;
}
Ron
modified on Monday, December 29, 2008 6:40 PM
|
|
|
|
|
I'm using TableAdapter.Update() to insert data to database. Is there a way to update ID columne value of the inserted row in the DataSet, hopefully without select @@identity/scope_identity() method?
|
|
|
|
|
Hello,
Last time I asked how can I create an sql server alias programatically,
and Mika gave me a great link which works great.
This is what I am doing:
ManagementScope scope = new ManagementScope(@"\\" + client + @"\root\Microsoft\SqlServer\ComputerManagement");
ManagementClass clientAlias = new ManagementClass(scope, new ManagementPath("SqlServerAlias"), null);
clientAlias.Get();
ManagementObject alias = clientAlias.CreateInstance();
alias.SetPropertyValue("AliasName", aliasName);
alias.SetPropertyValue("ServerName", server);
alias.SetPropertyValue("ProtocolName", prot);
alias.SetPropertyValue("ConnectionString", conn);
alias.Put();
If the client is my local computer - works greate.
If it is a remote connection, I keep getting access denided.
What priviliges do I need ?
I tried using ConnectionOptions with user that has administrator priviligies on the client - didn't work.
Thanks
Calanit
|
|
|
|
|
Does your SQL Server permit remote connections? Is the user defined in the connection string permitted access. If you are using a trusted connection, is it a domain user?
|
|
|
|
|
Colin Angus Mackay wrote: Is the user defined in the connection string permitted access. If you are using a trusted connection, is it a domain user?
Is the bear in the woods, with a paper in one paw and some Andrex in the other?
|
|
|
|
|
Thanks - checked all the permisions, was missing domain user connection string permision.
|
|
|
|
|
calanit wrote: If it is a remote connection, I keep getting access denided
I think you need admin privileges on the target computer (not sure though). Did you have look at this: http://msdn.microsoft.com/en-us/library/system.management.managementscope.aspx[^].
One thing that could be the problem is that if you use a different username/password than your current session, do you spoecify also the domain (either the real domain if youre using domain admin or the computername itself if your useing the computer local admin).
From the link:
<code>ConnectionOptions options = new ConnectionOptions();</code>
|
|
|
|
|
Hi Mika,
Yes, I needed administrator priviliges - it is a must.
Thanks
Calanit
|
|
|
|
|
You're welcome
Mika
|
|
|
|
|
I have been wracking my brain for hours on this problem.
I have a DataGridView object that has a DataGridViewComboBoxColumn inside of it. The combo box displays fine and is populated from an Access database. The column has the Primary key mapped to the ValueMember variable and the column 'Type' is mapped to DisplayMember.
What I need is for each of these combo boxes to have their selected index (I think it is the Value property under DataGridViewComboBoxCell, but I'm pulling at straws at this point) be populated from another table. This took me about 6 seconds in Access. My problem is I cannot even find a way to access the Value/SelectedIndex of the Combobox once I place it in the DataGridView.
If anyone could help me out I'd greatly appreciate it.
Here is the code:
OleDbConnection dbCon = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\"" + "NGDemoSetup.mdb" + "\"");
DataSet ds = new DataSet();
DataSet cboDs = new DataSet();
DataGridViewComboBoxColumn cboCol = new DataGridViewComboBoxColumn();
dbCon.Open();
OleDbDataAdapter da = new OleDbDataAdapter("SELECT AddrType,isRange,Value1,Value2 FROM LOCATIONINFO", dbCon);
OleDbDataAdapter cboDa = new OleDbDataAdapter("SELECT * FROM ADDRESSTYPES", dbCon);
da.Fill(ds, "LocationInfo");
cboDa.Fill(cboDs, "AddressTypes");
cboCol.Width = 100;
cboCol.DataSource = cboDs.Tables[0];
cboCol.ValueMember = "ID";
cboCol.DisplayMember = "Type";
DataTable dt = ds.Tables["LocationInfo"];
grdAddressInfo.DataSource = dt;
grdAddressInfo.Columns.Insert(0, cboCol);
grdAddressInfo.Columns[0].HeaderText = "Address Type";
grdAddressInfo.Columns[1].HeaderText = "Ranged Value";
grdAddressInfo.Columns[2].HeaderText = "From";
grdAddressInfo.Columns[3].HeaderText = "To";
dbCon.Close();
|
|
|
|
|
You can create objects of the items and then add the list of objects to the combo box.This way you can access the selected object from the datagridview cell.
|
|
|
|
|
pls help guys
im a intermediate level in c#....anyone guide me from begining to end to create a migration project in
"<big>text parsing or automatic segmentation of text</big>"
from c and c++ to c#...
i'll answer ur doubts regarding this...kindly help me.... its my college project..... time duration is 25 days<b></b>
|
|
|
|
|
|
Can you give us more detail on what you are looking at?
|
|
|
|
|
More details? He's looking for someone to do his homework.
only two letters away from being an asset
|
|
|
|