|
You might try posting this in the ASP.NET[^] forum.
|
|
|
|
|
Hello,
Is there a way to display a full row from a dataset, using some command,
or do I have to use sort of this statement where I have to list every column I want to be displayed.
Debug.WriteLine ("Row: "+myRows[0]["ProjectID"]+","+myRows[0]["ProjectTypeID"]+","+myRows[0]["EmployeeID"]+","+myRows[0]["VersionNumber"]);
Thank you
|
|
|
|
|
You could use WriteRow
<code>void WriteRow(DataRow row)
{
string str = "Row: ";
for(int i = 0; i < row.Table.Columns.Count; i++)
str += row[i].ToString();
Debug.WriteLine(str);
} I haven't tested this code, but it should work OK. I know a StringBuilder would be more efficent, but that's left as an excerise for the reader. (You could also output column names this way.)
Good luck!
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Hi friends,
I'm trying to detect locking of my workstation. so far I've worked a lot on it and the result of it is as following...
protected override void WndProc(ref System.Windows.Forms.Message m)<br />
{<br />
<br />
<br />
switch(m.Msg) <br />
{<br />
case WM_WTSSESSION_CHANGE:<br />
MessageBox.Show("Entered Session Change");<br />
switch((int)m.WParam)<br />
{<br />
case WTS_CONSOLE_CONNECT:<br />
MessageBox.Show("WTS_CONSOLE_CONNECT","WM_WTSSESSION_CHANGE");<br />
break;<br />
case WTS_CONSOLE_DISCONNECT:<br />
MessageBox.Show("WTS_CONSOLE_DISCONNECT","WM_WTSSESSION_CHANGE");<br />
break;<br />
case WTS_SESSION_LOCK:<br />
MessageBox.Show("WTS_SESSION_LOCK","WM_WTSSESSION_CHANGE");<br />
break;<br />
case WTS_SESSION_UNLOCK:<br />
MessageBox.Show("WTS_SESSION_UNLOCK","WM_WTSSESSION_CHANGE"); <br />
break;<br />
default:<br />
break;<br />
}<br />
break;<br />
<br />
default:<br />
break;<br />
}<br />
base.WndProc(ref m);<br />
}
The Messages like WTS_SESSION_LOCK and etc are also defined/declared in the application, as their values are found in windows.h;
Friends, my problem is that my application is running but it is neither responding to the code written above neither is generates any errors.
Please help me solve this problem. I want my system to respond to the above written code. Do I need to change it or any suggestions????? Please reply As Soon As Possible.
Thank u very much all in advance.
|
|
|
|
|
I've read a bunch of hubbub about side-by-side versioning in .NET, but what I haven't seen so far is a "live patching" mechanism. Specifically, I work with lots of ASP.NET applications, and we've had many many cases where we've ended up having to do complete releases to change one line of code. Surely there's a better way... In the old days' we'd have some sort of binary diff program we'd run on the executable... what's the right way to go here? And what's the right way to go specific to ASP.NET, where there are a lot of runtime generated assemblies?
Ian
|
|
|
|
|
If all you change is an aspx, you can just upload that file. If you change the code, then you need to upload the dll. You don't need to upload all your aspxs, just because you changed a line of codebehind.
I'm sure a binary diff ( being just a binary process ) will work just as well in .NET as it did in C++.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hello,
I have the statement as indicated below, after I find the appropriate the row in my dataset, I want to duplicate this whole row, but change the values of 2 row element. How can I do that?
foreach (DataRow row in dataset.Tables["Versions"].Rows) {
if ((row["ProjectID"].ToString() == currProjID) && (row
["VersionNumber"].ToString() == currentVersion)) {
string verID = row["VersionID"].ToString();
if (row["IsProjectSetupComplete"].Equals(true)) {
WHAT GOES IN HERE?
}
}
}
Thank you.
|
|
|
|
|
row["col"] = new value;
dataset.Tables["Versions"].Rows.Add(row.ItemArray);
|
|
|
|
|
Im unable to find an error with this supposedly incorrect snippet that appeared in an aptitude test..please help me ASAP!!
i'd be very greatful...Thanx!
class Singleton
{
public static Singleton Instance() {
if (_instance == null)
_instance = new Singleton();
return _instance;
}
protected Singleton() {}
private static Singleton _instance = null;
}
Rohit(Mumbai)
|
|
|
|
|
I think the only thing I can see that is wrong is that the constructor is protected. Therefore if a second class derived from this class then it would be able to call the base() call from it's constructor. The class itself would need to be set as FINAL so that no derived classes could be created.
Anybody else spot anything else????
|
|
|
|
|
The singleton code is not thread safe. If it is guaranteed to run in a single threaded fashion, then I don't see any problem. But if two threads happen to call Instance() at the same time, there is a chance that there would be two separate Singleton objects, which defeats the very purpose of having a singleton.
The right way to do it is to protect the Instance() method with a lock. Something like
private static object syncObject = new object();
public static Singleton Instance()
{
lock(syncObject)
{
if (_instance == null)
_instance = new Singleton();
return _instance;
}
}
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Does anyone here know where to find and how to use Microsoft's timezone control (the one where you set your time zone from Control Panel/Date & Time; shows a flat projection of the globe)?
Ideally, I'd like something like .NET's fontDialog() or colorDialog().
|
|
|
|
|
If you don't care about the return value, you can just shell to
c:\winnt\system32\timedate.cpl
to pop up the date/time control panel applet.
Sean
|
|
|
|
|
Thank you, Sean. That is very helpful, I'll investigate timedate.cpl. I do need to get the timezone the user selects, without actually changing the PC's settings. This is so a new timezone can be selected for a "World Clock" application.
Thanks again for your help.
John
|
|
|
|
|
Ahhh, sorry, I don't think this will do what you want then. There are no command line parameters passable to the control panel applet (that I can find), and no way to retrieve the value once the user has set it by just shelling to the applet.
I don't think the map selection functionality is exposed as an ActiveX control either.
Sorry 'bout that.
Sean
|
|
|
|
|
I want to dynamically load DLLs (created from VB) and instantiate a class with a particular name, like "ProcessClass".
I am able to load the DLL and confirm there is a class by that name BUT I can't seem to create it or call methods to this newly created instance. I have the following code:
public class Script
{
[DllImport("oleaut32", CharSet=CharSet.Unicode)]
private extern static void LoadTypeLib(string dllFilePath, out UCOMITypeLib typeLibrary);
UCOMITypeLib typeLibrary;
LoadTypeLib(dllName, out typeLibrary);
for (int i = 0; i < typeLibrary.GetTypeInfoCount(); i++)
{
typeLibrary.GetDocumentation(i, out typeName, out typeDocumentation, out typeHelpContext, out typeHelpFile);
if (typeName == "ProcessClass")
{
UCOMITypeInfo typeInformation;
object classInstance;
typeLibrary.GetTypeInfo(i, out typeInformation);
typeInformation.CreateInstance(null, ref guidIUnknown, out classInstance);
MethodInfo method = classType.GetMethod("DoSomething", BindingFlags.InvokeMethod | BindingFlags.Instance | BindingFlags.Public );
method.Invoke(classInstance, new object[0]);
}
}
}
Am I going down the wrong road? The class seems to be created without exception, but the created instance doesn't seem to be bound properly as I don't see any of the methods I'm looking for when I loop through!!
-Ray
|
|
|
|
|
I'm trying to inherit a form an initially am able to do so, however when I build the project I loose the design view for the new inherited form. In the design view tab it says there was an exception 'Request for the permission of type System.Security.Permissions.SecurityPermission failed'
The project still builds and no error is thrown when the form is instantiated at run time. Any ideas where I might be going wrong?
|
|
|
|
|
A lot of my controls don't show nicely in the design view, and I had one that broke the build, although the code would have been fine if it built and ran. I don't bother to fix them, I'd rather have the code look the way I want, than hack for the sake of a view I almost never use.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Is there an artical anywhere describing how to hack around such problems though? I've got a project with a control that generates a null reference exception in the designer with any form that uses it. At long as it's not exceptionally bad how the code looks isn't a major concern since the control's just slurped out of the dll, while the forms involved are being actively modified.
|
|
|
|
|
I found that the problem is that the visual designer tries to render the form, so look through your constructor and any events such as OnPaint, and imagine they are being called without any properties being set. I fixed the one that broke the build by moving code from the init event to another method, and wrapping it in code that guarded against it being called by checking first that everything was in the correct state for it to occur.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi,
I was wondering if any one had some ideas or good places to look for help on a alphnumeric counter.
The count I want to put into place is one that starts at 'AAA000' and continues with 'AAA001' and so on. So when the number hits 999, the next record will have a id of 'AAB000'
Please let me know if you have any ideas or a good site to visit.
Thanks.
|
|
|
|
|
Wow - you asked this in the SQL forum, so I thought you wanted it to be in T-SQL. A counter like this is easy - just define the numeric portion and the letter portion. Then when the numbers hit 1000, roll over and increment a letter.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I'm trying to post a string of xml to another site and I've set up a test script on my own machine to recieve and parse the xml and return a value. When I run that page by itself and feed it some xml, it works fine. But, when I try to call it with the webrequest object, I get an internal server error. Can anyone see what I'm doing wrong here? I've never used this class before so I'm not really sure if I'm doing everything I'm supposed to. Thanks. Oh, and it errors on the line that says WebResponse myWebResponse = myRequest.GetResponse();
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("http://localhost/test.asp");
myRequest.Method="POST";
myRequest.ContentType = "application/x-www-form-urlencoded";
ASCIIEncoding encoder = new ASCIIEncoding();
// Convert the string into a byte array.
byte[] xmlBytes = encoder.GetBytes("xmlData="+xDoc.InnerXml);
myRequest.ContentLength = xmlBytes.Length;
Stream newStream=myRequest.GetRequestStream();
newStream.Write(xmlBytes,0,xmlBytes.Length);
newStream.Close();
// Return the response.
WebResponse myWebResponse = myRequest.GetResponse();
// Obtain a 'Stream' object associated with the response object.
Stream ReceiveStream = myWebResponse.GetResponseStream();
Encoding encode = System.Text.Encoding.GetEncoding("utf-8");
// Pipe the stream to a higher level stream reader with the required encoding format.
StreamReader readStream = new StreamReader( ReceiveStream, encode );
response = readStream.ReadToEnd();
readStream.Close(); readStream = null;
myWebResponse.Close();
|
|
|
|
|
nevermind. after playing with some other debugging code, I found that the problem ended up being in the page that receives the xml and that it's not receiving it correctly.
|
|
|
|
|
hi to all,
how can i send sql server message to my c# application.
exemple :
in a stored procedure i use the RaiseError keyword with a specific number and description.
all i want to do is to get these two informations in my c# application.
does any know how ?
best regards and thanks in advance
fady
|
|
|
|