|
Wow, thanks. LoL. I had no idea about the "Tag" property for TreeNode objects. I'll play with the example you gave and if I need anymore information I'll come back. Thanks a lot.
|
|
|
|
|
Alright, after reading your post and researching this a little bit, I finally implemented the code. I'll tell you, it looks 10x cleaner. LoL. Another thing I noticed is that when I ran the Code Metrics (VS2010) before, the "Maintainability Index" for that particular form was around 46 or 48 I believe. After changing to the method you described it went up to 55. I still have a few areas that I need to break into separate methods, which I believe may bring it up some more.
Thanks a lot for the help.
|
|
|
|
|
Glad to help
|
|
|
|
|
This seems like a stupidly simple request to me, but for some reason I cannot get it to work:
The hibernate manual says this:
String sql = "SELECT ID as {c.id}, NAME as {c.name}, " +<br />
"BIRTHDATE as {c.birthDate}, MOTHER_ID as {c.mother}, {mother.*} " +<br />
"FROM CAT_LOG c, CAT_LOG m WHERE {c.mother} = c.ID";<br />
List loggedCats = sess.createSQLQuery(sql)<br />
.addEntity("cat", Cat.class)<br />
.addEntity("mother", Cat.class).list()
Now, what I have is basically the same. I am return two of the same type per row. I am doing a select something like this:
SELECT {ctrl1.*}, {ctrl2.*} FROM tableA AS A<br />
LEFT JOIN tableB AS ctrl1 ON (A.controlID = ctrl1.controlID AND ctrl1.controlOptionType = ? AND ctrl1.controlOptionValue = ?)<br />
LEFT JOIN tableB AS ctrl2 ON (A.controlID = ctrl2.controlID AND ctrl2.controlOptionType = ? AND ctrl2.controlOptionValue = ?)
And then I addEntity("ctrl1", typeof(mycontrolclass) and addEntity("ctrl1", typeof(mycontrolclass)
Which seems exactly the same to me as their example. But I get this exception: "Could not execute query" and the inner exception is "Could not find specified column in results". If I copy the sql in the exception(to which it has added "AS ctrl1_1_3_3_" etc) it works fine.
Thanks.
Strive to be humble enough to take advice, and confident enough to do something about it.
|
|
|
|
|
It seems that I can't get this right... I'm using the following signature:
[DllImport("coredll.dll")]
private extern static uint RasGetEntryProperties(string lpszPhoneBook, string szEntry, ref RASENTRY lpbEntry,
ref int lpdwEntrySize, byte lpb, int lpdwSize);
Calling it with the following parameters:
RasGetEntryProperties(null, name, ref RasEntry, ref dwSize, 0, 128);
However, whenever this is called, an error pops up on my device telling me there has been a native exception, without much detail.
I've declared the RASENTRY struct as follows:
private struct RASENTRY
{
public int dwSize;
public int dwfOptions;
public int dwCountryID;
public int dwCountryCode;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = RAS_MaxAreaCode + 1)]
public string szAreaCode;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = RAS_MaxPhoneNumber + 1)]
public string szLocalPhoneNumber;
public int dwAlternatesOffset;
public RASIPADDR ipaddr;
public RASIPADDR ipaddrDns;
public RASIPADDR ipaddrDnsAlt;
public RASIPADDR ipaddrWins;
public RASIPADDR ipaddrWinsAlt;
public int dwFrameSize;
public int dwfNetProtocols;
public int dwFramingProtocol;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = MAX_PATH + 1)]
public string szScript;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = MAX_PATH + 1)]
public string szAutoDialDll;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = MAX_PATH + 1)]
public string szAutoDialFunc;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = RAS_MaxDeviceType + 1)]
public string szDeviceType;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = RAS_MaxDeviceName + 1)]
public string szDeviceName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = RAS_MaxPadType + 1)]
public string szX25PadType;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = RAS_MaxX25Address + 1)]
public string szX25Address;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = RAS_MaxFacilities + 1)]
public string szX25Facilities;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = RAS_MaxUserData + 1)]
public string szX25UserData;
public int dwChannels;
public int dwReserved1;
public int dwReserved2;
public int dwCustomAuthKey;
}
Any help would be appreciated, thanks!
-Brandon
|
|
|
|
|
Hi guys. I am having a problem with the above. I am trying to update the changes made to the gridview back to the database but for some reason I get a "Data Type mismatch in criteria expression" OleDbException. I have tried a number of updates but nothing seems to work. Below is the code I am using. I have delete section which works fine. Just the Edit portion that doesn't work. Can somebody please advise what I am missing here?
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
int currentRow = int.Parse(e.RowIndex.ToString());
int rowint = 0;
string sql = "SELECT TimesheetDetailID, EmployeeID, TSProjectCodeID, TimeSheetDate, HoursWorked, TaskCode, Notes from tblTimesheetDetails WHERE TimesheetDetailID ='" + rowint + "'";
string empID = dataGridView1[1, currentRow].Value.ToString();
string projcode = dataGridView1[2, currentRow].Value.ToString();
string timedate = Convert.ToString(dataGridView1[3, currentRow].Value.ToString());
double hrs = Convert.ToDouble(string.Format("{0:f}", (dataGridView1[4, currentRow].Value.ToString())));
string taskcode = dataGridView1[5, currentRow].Value.ToString();
string notes = dataGridView1[6, currentRow].Value.ToString();
OleDbDataAdapter da = new OleDbDataAdapter(sql, conn);
OleDbCommandBuilder cmb = new OleDbCommandBuilder(da);
da.Fill(dataTable);
string updateString = "Update tblTimesheetDetails SET EmployeeID ='" + empID + "', TimesheetID ='" + "" + "', TSProjectID ='" + projcode + "', TimeSheetDate ='" + timedate + "', HoursWorked ='" + hrs + "',TaskCode ='" + taskcode + "', Notes ='" + notes + "' WHERE TimesheetDetailID ='" + rowint + "'";
try
{
conn.Open();
string timesheetString = dataGridView1[0, currentRow].Value.ToString();
rowint = int.Parse(timesheetString);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
if (dataGridView1.Columns[e.ColumnIndex] == deleteButton && currentRow >= 0)
{
string queryDeleteString = "DELETE FROM tblTimesheetDetails where TimesheetDetailID = " + rowint + "";
OleDbCommand sqlDelete = new OleDbCommand();
sqlDelete.CommandText = queryDeleteString;
sqlDelete.Connection = conn;
sqlDelete.ExecuteNonQuery();
}
else if (dataGridView1.Columns[e.ColumnIndex] == editButton && currentRow >= 0)
{
try
{
if (dataTable.Rows.Count != 0)
{
dataTable.Rows[rowint]["EmployeeID"] = empID;
dataTable.Rows[rowint]["TimesheetID"] = 0;
dataTable.Rows[rowint]["TSProjectCodeID"] = projcode;
dataTable.Rows[rowint]["TaskCode"] = taskcode;
dataTable.Rows[rowint]["TimeSheetDate"] = timedate;
dataTable.Rows[rowint]["HoursWorked"] = hrs;
dataTable.Rows[rowint]["Notes"] = notes;
dataTable.AcceptChanges();
da.Update(dataTable);
}
}
catch (OleDbException exx)
{
MessageBox.Show(exx.Message.ToString());
}
}
conn.Close();
GetDataView();
}
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
Do your table in the database have PK ?
I know sounds a bit Odd , but I was facing some problems in OleDB AcceptChanges() things ,
And solved by Adding PK to Mt Table in the database
thanks
I know nothing , I know nothing ...
|
|
|
|
|
Hi.
Yes, it does have a primary key. I am using the primary key to get the exact record in the cdatabase to update.
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
You are passing all your criteria as strings, I suspect the date format is incompatible with the database.
Set a break point on conn.open() and inspect the string, try and execute the string in SSMS.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi Mycroft. Sorry for taking this long to reply. I have actualy set the DateColumn in the DB to a string column and I am passing a string. I have now tried numerous things and it just won't work. I have now decided to abandon the save changes from the datagrid and just to delete the row and the users can retype. I know it is not the best thing to do but if I can't et it working then I am stuck with doing that.
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
the problem m facing is it works fine on same PC when i put both peers on a single PC. but when i try to run it on LAN receiving call PC get hanged, y is it.
thanks in advance. waiting for reply
here is the code. these are the h323 events i have used
void h323_RemoteBusy()
{
MessageBox.Show("User is busy");
}
void h323_Disconnected(string RemoteUserName)
{
MessageBox.Show("Call Disconnected ");
btnCall.IsEnabled = true;
btnEndCall.IsEnabled = false;
btnVideo.IsEnabled = false;
lblCallStatus.Visibility = Visibility.Hidden;
}
void h323_Connected(string RemoteUserName)
{
System.Windows.Forms.DialogResult myDialogResult = System.Windows.Forms.MessageBox.Show("Incomming Call by " + RemoteUserName + "\nDo u want to recieve Call?", "Message", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question);
if (myDialogResult == System.Windows.Forms.DialogResult.Yes)
{
h323.Answer();
}
else
{
h323.Hangup();
}
}
|
|
|
|
|
Third time you have posted the same question.
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
Hi , have a good day
How do I give already Compiled .NET DLL "strong-name"
P.S:
I have my key ( MyWork.snk )
thanks
I know nothing , I know nothing ...
|
|
|
|
|
|
Hi ,
How do I give already Compiled .NET DLL "strong-name" using sn.exe tools
thanks
I know nothing , I know nothing ...
|
|
|
|
|
sn -rtfm myassembly.dll -key strong.coffee
[clue - get one]
Panic, Chaos, Destruction.
My work here is done.
or "Drink. Get drunk. Fall over." - P O'H
|
|
|
|
|
Thanks ,
I bet you don't know the answer, Otherwise you will put it here !
This is for you kindness
I know nothing , I know nothing ...
|
|
|
|
|
The answer is the first line of his post. You're concentrating on the second line only.
The documentation can be found here[^].
--edit
I didn't read the first line of his post very well, my apologies. It won't execute on the console, but it would be quite some hint on where to get started.
I are Troll
|
|
|
|
|
thank you
I know which line of his replay contain the rude sarcasm of what you called an answer , "RTFM"
----
And I think there is no WAY to sign compiled.net Assembly With SN.exe tool!
May be I need another tool, something like .NET Protect software !
P.S :
Non of you know what the SN.exe documentation contains ! , you never read it !
You only read the title , and you think by providing a link for such a manual, Doing a good for me !!
Or helping me create my Own ways to answer all my Questions , like some freak monks in chines , Japanese movies!
BTW , I read the manual before I ask the Question , and I have Googled it !
Edit :
And I am sorry too , I don't want to be an @$$
I know nothing , I know nothing ...
modified on Thursday, July 29, 2010 12:44 PM
|
|
|
|
|
Stark DaFixzer wrote: I know which line of his replay contain the rude sarcasm of what you called an answer , "RTFM"
Again my apologies, I assumed that the answer given was correct and that you were having problems executing it on the console. I just tried it, doesn't work as expected.
Stark DaFixzer wrote: And I am sorry too , I don't want to be an @$$
You were right.
FWIW, found this[^] article on how to bypass it. Not easy though.
I are Troll
|
|
|
|
|
it's OK , I wrote my post before you edit yours ,
then I edit mine after you edit yours
Apologies Accepted ,
I know nothing , I know nothing ...
|
|
|
|
|
Thanks
|
|
|
|
|
And your link save my day thank you !
I know nothing , I know nothing ...
|
|
|
|
|
LOL! 5 - but I think it went "whooosh" with the OP.
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
Does anyone know how to determine 'dirty' state of a Castle ActiveRecord?
If I have an ActiveRecord class called Note, and I have a List<note>, how to I determine which notes have been changed?
|
|
|
|
|