|
I want to check whether the user is able to connect to a host specified with given user name and password or not in network.
I used NetWorkCredential class but with that I am unable to validate the user name and password.
Can any one suggest me a way to do the same.
Thanks in advance.
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
Why am I getting this error? My stored procedure is returning the value of an int column...
try {
SqlDataReader r = run_sql_reader(sql);
if (r.Read()) {
LB_CO_record_number.Text = (r.GetInt32(0)).ToString(); //***exception here
}
r.Close();
} catch (Exception ex) {
MessageBox.Show(ex.Message);
}
Visual Studio is not telling me what is trying to be casted to what else, so I can't figure out which thing is causing the error. I do this kind of thing all the time and I've never gotten this error.
"Quality Software since 1983!"http://www.smoothjazzy.com/ - see the "Programming" section for freeware tools and articles.
|
|
|
|
|
Mmmmkay... I figured it out. My proc was for some reason not returning an int column. I don't know what it was returning, but using "convert" on the value before sending it back fixed the problem. Crazy computers
|
|
|
|
|
By any chance did you get a NULL returned from the database. Attempting to convert NULL to another might succumb with System.InvalidCastException: The specified cast is invalid .
Vasudevan Deepak Kumar
Personal Homepage
Tech Gossips
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
|
|
|
|
|
No it returns a number, which I verified, but it's good to know that. I'll add some code to check for that. Thanks!
|
|
|
|
|
How to code in C# calling the stored procedure with no parameter.
Inside my stored procedure is just to delete specified column.
thanks,
******************************
I just want to
know everything
|
|
|
|
|
Please post the code that you tried and is not working. It should be a simple call...
|
|
|
|
|
Create an instance of SqlCommand class and set command text to the name of the stored procedure. Don't forget to set the type of the command to. You can then execute it by calling ExecuteNonQuery() method
|
|
|
|
|
following namespace not found :-
Microsoft.Office.Interop.Excel.ApplicationClass
Gaurav
|
|
|
|
|
Make sure you have added the assembly in your references in your project. Otherwise, please post more information.
|
|
|
|
|
creating and saving excel work sheet at runtime
Gaurav
|
|
|
|
|
G.K.M. wrote: creating and saving excel work sheet at runtime
And I'm eating vanilla ice-cream generously poured over an apple turnover. Yum!
/ravi
|
|
|
|
|
Is there a way to implement a "read only" struct whose fields are directly readable but not writable?
The examples I'm seeing all make the struct fields private, and then implement a method to read them. So, instead of using
myHours = TimeStruct.Hours;
they all force
myHours = TimeStruct.Hours();
I'd prefer to have it work the first way, but not allow the caller to change the field value. IE,
TimeStruct.Hours = 12;
would fail or throw an exception or simply not be possible.
|
|
|
|
|
You're reading the wrong examples. Use either readonly fields
public readonly int Hours ;
or readonly properties
private int hours ;
public int Hours { get { return hours ; } }
|
|
|
|
|
Ooohhhh.... tasty.
Damn these C# books! I suppose they were really just telling me to control access to the fields, but still... can't they assume I'm relatively dumb?
[modified] Forgot to say "thanks". Thanks!
|
|
|
|
|
"C# For Dummies" is good.
|
|
|
|
|
Actually, I have to say: I hated that one. The hoaky tip titles and non-programming content just drove me crazy.
Microsoft Visual C#2005: Step by Step is pretty good, but it limits itself. The writing, though, is very clear.
|
|
|
|
|
JoeRip wrote: Is there a way to implement a "read only" struct whose fields are directly readable but not writable?
Just to add to what PIEBALDconsult said. It sounds like what you are wanting to do is create an "immutable" object (unless you have some other mechanism where you update the fields). An immutable object is one that once created does not change. Typically, if you want to change an immutable object you just create a new one.
Strings are an example of immutable objects. If you create a string then call something like ToUpper() on it you get back a new string. The original string is not changed.
(Just to add to your vocabulary)
|
|
|
|
|
I always get this exception -- System.Data.OracleClient.OracleException: ORA-00911: invalid character at System.Data.OracleClient... which indicates the connection is not valid.
Following is my code:
string connectionString = "Data Source=ora01;User ID=zd01;password=1234;Persist Security Info=True;";
OracleConnection con = new OracleConnection(connectionString);
con.Open();
string sql = "insert into ua_user values(4, 'vivien', 'vivien', 9);";
OracleCommand command = new OracleCommand(sql, con);
command.ExecuteNonQuery();
con.Close();
the sql command is working, and this worked under .net 1.1, now I am writing under .net 2.0, it seems refuse to work.
Can anyone tell me what I did wrong, thank you in advance.
|
|
|
|
|
I have a form that takes a file with like 1800 students and adds them to active directory. I think I have the backgroundworker working, but I want to update the form with each name added. I see how to use progresschange to update a progress bar, but I can't seem to pass messages.
I tried some sort of thread creation with invoking, but I still don't see how I pass the message to that thread.
Any ideas or a link to good tutorial? the ones I find only deal with passing integers with updateprogress.
Thanks
|
|
|
|
|
|
I read the following article on how to draw the contents of an application screen to a bitmap. I am wondering if there is any way to get this to work if the screen is minimized? I would like to do a screen capture of a minimized window, if possible. Does anyone have some ideas as to how I can do this? Thanks,
http://www.codeproject.com/csharp/screen_capturing.asp[^]
Jeff
|
|
|
|
|
Hi Jeff!
I have not yet read that article, it's on my todo list.
An application is or can be aware it is minimized, since it is getting Resize events
(with zero width and height), so chances are it will refuse to paint anything as long as
it is minimized.
So my best guess is restore it to normal size, move it outside the regular screen area
if you don't want to see it (say Location=-30000,-30000), use Control.DrawToBitmap on the
Form, then restore location and state.
I am not sure you can set location before leaving minimized state to avoid a glitch though.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hello, Im having difficulties with a button with hover text.
I have a standard button that I created a hover event for.
this.gpsInfo.MouseHover += new System.EventHandler(this.gpsInfo_MouseHover);
then i create a tooltip
private void gpsInfo_MouseHover(object sender, EventArgs e)
{
tp = new ToolTip();
tp.Show("GPS Information", gpsInfo);
}
For some stupid reason, the message shows up more than once. So I tried other events like mouse cursor change, when your over the button. And then call the tooltip when the cursor changes, but that doesnt work at all.
Help............... Do I have to go graphics..
|
|
|
|
|
I hate to say use the wizard but if you add a tooltip to the form and then select the given tooltip from the controls properties window it should work nicely.
The end result is:
Create a member: private System.Windows.Forms.ToolTip toolTip1;
In init:
this.toolTip1.SetToolTip(this.button1, "Rwar");
It should work automatically.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|