|
Hi Tarsan,
Thanks soooooo much, I am very happy to tell you that, your tips are working very nice.
First it did not work, I found that, if i place this header using MSHTML; at the top of the code, then it works.
Thanks again.
Emran
|
|
|
|
|
hi all
i am working in a MDI Application , and i want to disable the autoscroll property of the midi parent form, i had used this but it didnt work
public Form1()
{
InitializeComponent();
this.AutoScroll=false;
}
how to solve this?
|
|
|
|
|
|
very nice and it works good
many thx
|
|
|
|
|
Hi,
I have a stored procedure and it looks like the following
ALTER PROCEDURE USP_NCUInsertContentCodeTest
@var1 int,
@var2 int
etc
AS
DECLARE @RC int
//Do stuff
RETURN @RC
I know how to execute the procedure in c# but I cant figure out how to get the return value. I know if I declared the @RC before the AS I could declare it as a parameter with parameterdirectio = output etc but I cannot change the stored procedure. How can I do it?
Thank you in advance,
Ed
|
|
|
|
|
why not just do: Select @RC instead?
it will return a DataSet to c#...fill the DataSet using a sqladapter and then access the variable:
DataSet ds = new DataSet();
//Do stuff
int result = (int)ds.Tables[0].Row[0][0];
hope that helps
|
|
|
|
|
Sorry I dont know what you mean by do a select @RC
|
|
|
|
|
He means that in your stored procedure, instead of using a return that you do a
SELECT @rc If you don't SELECT anything else in the stored procedure then this can work quite well. In your C# application you would use ExecuteScalar() on the SqlCommand class in order to retrieve the result, like this:
SqlCommand cmd = new SqlCommand();
cmd.Connection = myConnection;
cmd.CommandText = "MyStoredProcName";
cmd.CommandType = CommandType.StoredProcedure;
int result = (int)cmd.ExecuteScalar()
Of course, if you are already returning other data from the stored procedure, this SELECT becomes a bit more difficult to manage. In that case you can retrieve the result by using a parameter to get the result of the RETURN statement.
In your command object add this to the list of parameters:
SqlParameter returnParam= new SqlParameter("RETURN_VALUE",SqlDbType.Int);
returnParam.Direction = ParameterDirection.ReturnValue;
cmd.Parameters.Add(returnParam); After you execute your stored procedure you can get the return value like this:
int result = (int)(cmd.Parameters["RETURN_VALUE"].Value)
int result = (int)returnParam.Value
Does this help?
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
-- modified at 13:30 Monday 23rd January, 2006
|
|
|
|
|
Xodiak wrote: it will return a DataSet to c#...fill the DataSet using a sqladapter and then access the variable:
That is so much overkill!
int result = (int)mySqlCommand.ExecuteScalar(); That is all you need.
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
interesting, how would you handle multiple variables returned(kinda like an output)?
|
|
|
|
|
Now you'd have to return those values as a dataset. Any stored procedure can only return one value using the return value method.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
To follow up on what Dave said (and, if I may quote Scotty in Star Trek V) use "the right tool for the right job".
You can also have a number of output parameters in the stored procedure.
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
Add a parameter with the direction ReturnValue. After the call it will contain the value.
---
b { font-weight: normal; }
|
|
|
|
|
|
|
What question? This is just a link to a dumb piece of code for timing writing out a bunch of numbers to the console. Big deal...
Besides, using this method to time code execution is only very roughly accurate. Use a library that uses the QueryPerformanceCounter methods for more accurate results.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-- modified at 12:18 Monday 23rd January, 2006
|
|
|
|
|
You're profiling the performance of Console.WriteLine. The console window will have to redraw for new lines, update it's scrolling buffer etc. The console window itself runs in another process (that's why you can see its content even when the application hangs or is suspended by a debugger); multiple processes=multiple threads => random timings. I didn't try to run the code, but I you should get completely different timings each time. Debug/Release won't have a difference since more than 99,9999% of the time is not spent in your code.
|
|
|
|
|
hi guys,
im developing a client/server app and i need to continuously check the connection between my server and its clients... how can i do that in c#.. how will i know if a connection is dropped.. or if my network cable is disconnected from the lancard.. im new in network programming.. i greatly appreciate any help and suggestions.. tnx guys..
|
|
|
|
|
The Receive/Send or BeginReceive/BeginSend methods will return 0 bytes received/sent when the connection is lost or closed by the other host.
___________________________________
Tozzi is right: Gaia is getting rid of us.
My Blog [ITA]
|
|
|
|
|
If the connection drops or gets severed, or when the timeout expires an exception will be thrown. I tend to send a 'blank' packet every 30-60 seconds, to force 'detection' of the network state. If its idle, it cant detect an error state.
HTH
xacc.ide-0.1.1.11 - now with Settings & AutoComplete(kinda)
|
|
|
|
|
One final note, since you can detect socket end of file (0 return of recv) you still need to plan for how to convey that event to your mainline code if it is not the same line of executing code. Typically a ManualResetEvent or Semaphore works fine for this. Particulary if we are talking about a multi-threaded model.
Mike Luster
|
|
|
|
|
It might sound like a stupid question but I dont know any thing about it so I thought I better ask(btw I googled before asking)!
What is portal Development? or What are .NET portals?
Can you also direct me to any available .NET Portals??
Thanks in advance.
A Student
|
|
|
|
|
A portal is basically a flexible, highly customizable web application that allows users to have one place to get information on a wide array of topics. For instance, if your company has separate HR, CRM, project management, and time-tracking systems, a portal application could provide an interface to interact with all of these systems in one place. So, all your employees would have to know is how to get to the portal. Additionally, most portals have a goal of reduced sign-on (RSO), if not single sign-on (SSO), which basically means the portal can pass credentials to other applications, which will automatically log you on.
There are two major .NET portal tools: DotNetNuke[^] and Rainbow[^]. I'd suggest DNN because it has the larger community backing (users and 3rd party modules). Know that DNN is VB and Rainbow is C#. I don't like VB, but I still think DNN is the better solution and have chosen to use it for several of my clients.
Michael Flanakin
Web Log
|
|
|
|
|
Thank you very much for the explaination. What about BI(Business Intelligence) portals? are they the same as DotNetNuke and Rainbow or are they different in any way?
If yes then is there any .NET BI portal available as well?
Once again thanks a lot .
|
|
|
|
|
Business Intelligence (BI) is a term that refers to creating reports. Typically, a tool that professes to be a "BI" tool is very customizable. Examples are Crystal Reports and SQL Reporting Services. BI tools are separate from portals. A BI Portal would simply be a portal that displays BI information. This means you'll need two tools.
Michael Flanakin
Web Log
Indigo Consulting Services
|
|
|
|