|
I believe this is exactly what I am looking for. Thanks for the help.
|
|
|
|
|
Can any body help me in how to create a new project and how to add files to that in VSS using c# .... i hav added the reference and i am able to log into VSS... pls help me ...
Thanks in Advance
Akhil
|
|
|
|
|
Hi,
I tried the code listed in here:
http://www.codeproject.com/cs/database/mdbcompact_latebind.asp[^]
But I get an exception that there is already an open connection, although there isn't.
On the "objJRO.GetType().InvokeMember" line I get:
"Exception has been thrown by the target of an invocation"
The inner exception is:
"You attempted to open a database that is already opened exclusively by user 'Admin' on machine . Try again when the database is available."
How can I solve this?
Thanks,
Roee.
|
|
|
|
|
I am writing a service desk application. I have an XML file that a c# webservice accesses.
I have 2 tables inside an xml document. I can read from the xml without any problems but writing back to the file causes errors. Here is an sample of the file:
<?xml version="1.0" standalone="yes"?>
<ServiceDesk xmlns="http://tempuri.org/ServiceDeskData.xsd">
<ServiceCategory>
<category>
<id>1</id>
<type>Hardware - PC</type>
</category>
<category>
<id>2</id>
<type>Hardware - Printer / Scanner</type>
</category>
</ServiceCategory>
<ServiceRequest>
<Call>
<id>PBS00001</id>
<User>Test</User>
<Category>2</Category>
<Description>Some text</Description>
</Call>
<Call>
<id>PBS00002</id>
<User>Someone</User>
<Category>1</Category>
<Description>gbhjbgjhb</Description>
</Call>
</ServiceRequest>
</ServiceDesk>
ServiceDesk is the root element and then ServiceCategory and ServiceRequest are the tables holding the data. The problem occurs when i try to write back a Call to the Service Request Table. If i write to the ServiceRequest table it says that the item (a string array of 4) is too big, and if i write to the Call table it puts it outside the </ServiceRequest> element which breaks the schema. Could anybody give me some suggestions?
The c# code i use is:
DataSet d = new DataSet();
d.ReadXml("http://localhost/ServiceDeskWS/ServiceDeskData.xml");
String [] s = new String[4];
s[0] = assignID();
s[1] = User;
s[2] = Category;
s[3] = Description;
d.Tables["Call"].Rows.Add(s);
d.WriteXml(Server.MapPath("ServiceDeskData.xml"));
Thanks
|
|
|
|
|
Is Category a string? If it's an integer, you should use an object[] instead.
Logifusion[^]
|
|
|
|
|
It was originally a string, but thats not the problem i'm having. The problem is writing back a call.
|
|
|
|
|
Well, what I would try if I were you is make the DataRow first: DataRow dr = d.Tables["Call"].NewRow();
Then I would apply the same values but to the actual row and see where it breaks:
dr["id"] = assignID();
dr["User"] = User;
dr["Category"] = Category;
dr["Description"] = Description;
If there's a problem with the data, at least you can pinpoint the line where it happens.
Logifusion[^]
|
|
|
|
|
No problems with the data it writes it to the file, but it puts it outside the </ServiceRequest> element which breaks the xml schema.
|
|
|
|
|
Sorry, I didn't understand the original question. I guess the thing you have to look at is that when you load an XML like this into a DataSet, it will silently create extra keys and relations between nested tables. You might want to take a look at the real structure of the "Call" table in a debug window and see what columns are really there.
Logifusion[^]
|
|
|
|
|
The problem is with your schema: you have two different definitions for category. The first (in ServiceCategory) is a complexy type with a sequence of simple types, the second (in ServiceRequest) is just a single element simple type. to do this, you should give them different names (Category and CallCategory).
Or try modeling themn as classes and using the xsd tool to create the corresponding schema.
|
|
|
|
|
Fixed it. It was because i didnt define the Parent Row, added it on the end instead of nesting it.
The finished code is:
DataRow Child = d.Tables["Call"].NewRow();<br />
Child["id"] = assignID();<br />
Child["User"] = User;<br />
Child["CallCategory"] = Category;<br />
Child["Description"] = Description;<br />
Child.SetParentRow(d.Tables["ServiceRequest"].Rows[0]);<br />
d.Tables["Call"].Rows.Add(Child);<br />
d.WriteXml(Server.MapPath("ServiceDeskData.xml"));
|
|
|
|
|
This code below works.
XmlQuery xmls = new XmlQuery(SavedFilePath + file);<br />
node = xmls.SelectMultipleAttributes("/AutorunArchitect/Files/File/@*");<br />
<br />
br = 1; int b =0;<br />
ListViewItem lst = null;<br />
while (node.MoveNext())<br />
{<br />
temp[b,br-1] = node.Current.Value;<br />
<br />
if (br % 4 == 0)<br />
{<br />
b++;<br />
br=0;<br />
}<br />
<br />
br++;<br />
}<br />
<br />
for (i=0; i <2; i++)<br />
{<br />
lst = listView1.Items.Add(temp[i,0]);<br />
lst.SubItems.Add(temp[i,1]);<br />
lst.SubItems.Add(temp[i,2]); <br />
}
This is the test XML file
<AutorunArchitect> <br />
<Files><br />
<File<br />
FileName="files.exe"<br />
FileSize="123.4 KB"<br />
FilePath="C:\test\"<br />
FileDescription="Program description1."<br />
/><br />
<File<br />
FileName="files.html"<br />
FileSize="14 KB"<br />
FilePath="C:\test_backup\"<br />
FileDescription="Program description2."<br />
/><br />
</Files><br />
</AutorunArchitect>
Everything runs great, but I was just wondering is this a good aproach or is there any other way that makes the code to run faster?
Thanks.
|
|
|
|
|
Hello,
I have seen lot's of example of RTC Client. But all are in VS6(VC++6 or VB6). Now I want to use it with C#.Net. Can any one tell me how to do this. I also seen some articles releted to RTC from this site. But found no satisfied result.
regards,
Divyang Mithaiwala
|
|
|
|
|
Hi
I have a form with some controls, in it, most of them are labels, and a panel for displaying video and one of label is blinking using timer.
sometimes i got an Overflow exception when a program is started and sometimes when label is blinking. this exception is random and not always thrown. when exception comes, it comes with quit and continue, and have detials of the stack trace, when continued, the one control which is mentioned in the stack trace are turned to red cross. this is happening with two three controls.
Regards
Shajeel
|
|
|
|
|
|
here is the complete exception which is not stackoverflow
************** Exception Text **************
System.OverflowException: Overflow error.
at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
at System.Drawing.Graphics.FillRectangle(Brush brush, Int32 x, Int32 y, Int32 width, Int32 height)
at System.Drawing.Graphics.FillRectangle(Brush brush, Rectangle rect)
at System.Windows.Forms.Control.PaintBackground(PaintEventArgs e, Rectangle rectangle)
at System.Windows.Forms.Control.OnPaintBackground(PaintEventArgs pevent)
at System.Windows.Forms.Control.InvokePaintBackground(Control c, PaintEventArgs e)
at System.Windows.Forms.Control.PaintTransparentBackground(PaintEventArgs e, Rectangle rectangle)
at System.Windows.Forms.Control.PaintBackground(PaintEventArgs e, Rectangle rectangle)
at System.Windows.Forms.Control.OnPaintBackground(PaintEventArgs pevent)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Label.WndProc(Message& m)<<<<
|
|
|
|
|
|
i have posted the same question on msdn forums, and after some help from people there it turns out that it may be caused by the use terminal like vnc or remote desktop. but still i havent found the way around.
u can see that here
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=505364&SiteID=1&PageID=0
thanks for help.
Regards
Shajeel
|
|
|
|
|
Hello guys,
I'm halfway of my program when I encounter a problem.
i'm trying to substring "test" string by this command(sample only):
string strTest = "test";
MessageBox.Show(strTest.SubString(2, 3));
and I get this result: t
My desired result is: st
but I got my desired result with this code:
string strTest = "test";
MessageBox.Show(strTest.SubString(2, 2));
I can't get why this happened. Code was supposed to be MessageBox.Show(strTest.SubString(2, 3)); right?
Thank you in advance...
|
|
|
|
|
t e s t
0 1 2 3
SubString(initial Position , lenght)
SubString(2, 2) is ok for get "st"
with SubString(2,3) you got an exception (System.ArgumentOutOfRangeException)
|
|
|
|
|
I think what he means is that SubString parameters are not begin and end position (like in Java), rather begining position and how much further from there,
Ex
Test
0123
SubString(2,2) - Te and two place further gives s and t. Third is out of arrays so System.ArgumentOutOfRangeException is thrown
|
|
|
|
|
Guys,,,
Thank you so much. Now I understand that the second parameter is the lenght, not the position of the character where you want to end.
Thankz so much..
|
|
|
|
|
paulcortez wrote: Code was supposed to be MessageBox.Show(strTest.SubString(2, 3)); right?
Second parameter is number of characters in the string you want to display. If you want to display the last two characters in the string, leave off the second parameter.
If you need to display a certain number of characters starting at 2 and you want to be sure it doesn't hit the out of range check the starting character plus number of chars you want to display against the strTest.Length value. If the starting plus number to display exceeds length, then you're out of bounds.
Mike Poz
|
|
|
|
|
Guys,,,
Thank you so much. Now I understand that the second parameter is the lenght, not the position of the character where you want to end.
Thankz so much..
|
|
|
|
|
public string Substring(
int startIndex,
int length
);
damianbc
|
|
|
|