|
I think we need to clarify our terms here. What does it mean to pass by reference? To pass the address of the thing we're passing (which may itself be a value or a reference) rather than the value.
Since web services and clients can run on completely disparate systems there is no type affinity and no common memory management between them. It is therefore meaningless to pass by reference in the sense described above.
However, if you are using .net to implement both the web service and the client, then the tool generates a proxy object that you use on the client to invoke the operations of the service. Since the proxy runs in the client appdomain there are no issues whatsoever with passing stuff to the proxy by reference. But the proxy method still passes the parameter as a SOAP-formatted XML message to the server, receives a respose as it does for any other request, and proceeds to update the external variable using the reference that was passed to it.
In other words, the reference never leaves the client at all and it is at best misleading to say that anything is "passed to the service as a reference".
|
|
|
|
|
Hi experts,
I am having a column name as Firstname/LastName, i am trying to filter this column using DataView.
DataView dv = new DataView(dtTemptable, "" + dtTemptable.Columns[1] + " in ('" + name + "')", null, DataViewRowState.CurrentRows);
I am getting an error:
Cannot find column [Firstname]. //i even used the column name diretly.
|
|
|
|
|
padmanabhan N wrote: i even used the column name diretly.
In that case, I think there must be some difference in the way you have represented 'Firstname' in your code and the database.
If you can get to the column in the Database Designer try copying and pasting it. It could be a casing error (FirstName, for example) or I have occasionally seen this fail because of a space inserted before or after the column name, even though it is supposed not to be possible.
Good Luck!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
I fully agree with Henry Minute.
I am providing you three scenarios.
Say I have a datatable like this
public DataTable MtDataTable()
{
DataTable dt = new DataTable();
dt.Columns.Add("First Name");
dt.Columns.Add("Last Name");
dt.Rows.Add("Niladri", "Biswas");
dt.Rows.Add("Deepak", "Goyal");
dt.Rows.Add("Padmanabhan", "N");
dt.Rows.Add("Code", "Project");
dt.Rows.Add("Niladri", "Biswas");
return dt;
}
In the Form's Load event, I wrote the following code
Scenario 1:
private void Form1_Load(object sender, EventArgs e)
{
DataTable dtTemptable = MtDataTable();
DataView dv = new DataView(dtTemptable, "[FirstName]", null, DataViewRowState.CurrentRows);
}
I got the error message "Cannot find column [FirstName]"
Scenario 2:
private void Form1_Load(object sender, EventArgs e)
{
DataTable dtTemptable = MtDataTable();
DataView dv = new DataView(dtTemptable, "[First Name]", null, DataViewRowState.CurrentRows);
}
I got the error message "Filter expression '[First Name]' does not evaluate to a Boolean term." But notice I thing, I did not receive the Column not find message. This time error occurs because it expects a boolean expression which I did not provided
Scenario 3:
private void Form1_Load(object sender, EventArgs e)
{
DataTable dtTemptable = MtDataTable();
DataView dataView = new DataView(dtTemptable);
dataView.RowFilter = "[First Name] IN ('Niladri')";
foreach (DataRowView drv in dataView)
MessageBox.Show(drv["First Name"].ToString());
}
This gives me the output as "Niladri" 2 times.
Hope this helps.
Niladri Biswas
|
|
|
|
|
Hi. I want to know on how to remove the cli header. I actualy dont know what this is... but i tried to dissasemble a random app. (.exe) with .NET Reflector and it said that it cannot be disass. because it does not contain a CLI Header.
If i try to dissasemble my .NET applications (just to create a new project and build it and then try to disassemble it) - it disassembles. Anyway on how to prevent on making this possible?
Thank you in advance!
Regards,
Matjaž
|
|
|
|
|
The reason it did not work (does not contain a CLI Header) is that it is a native app, rather than a .NET managed app. These do not work with reflection.
As regards your .NET apps, the best you can do is obfuscate[^] it.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Correct. I will just add that it's still of course possible to disassemble any application; a native app just requires a native disassembler rather than a .net one. And native apps don't contain the metadata to reconstruct high-level code like .net apps do.
So it would seem an alternative to obfuscation could be to write your secret code in C++ and compile it natively, then create a .net assembly that is a thin wrapper to use this native .dll in your .net apps. But it's not an attractive route to go imo if you're a .net programmer, especially if you haven't made native apps before and don't plan to do so anyway.
Isn't copyright enough? 
|
|
|
|
|
dojohansen wrote: Isn't copyright enough?
Um. I can think of a few sites that have been on the news recently that imply not...
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Ok. Thanks.
I went over the documentation u gave me and will try to work something out.
Thanks for your help!
Regards,
Matjaž
|
|
|
|
|
Hi,
lately I worked on some applications using the Model View Preseter Pattern combined with events with return values to refresh Gui controls. It works pretty good so I´m wondering why there is a convention saying events should have the return value 'void'.
I would appreciate if someone could explain the reason for that rule...
Thx in advance...
Chamundi
|
|
|
|
|
http://msdn.microsoft.com/en-us/library/4b612y2s.aspx[^]
An event is an association between a delegate and a member function (event handler) that responds to the triggering of the event and allows clients from any class to register methods that comply with the signature and return type of the underlying delegate.
The delegate can have one or more associated methods that will be called when your code indicates that the event has occurred. An event in one program can be made available to other programs that target the .NET Framework common language runtime
So in short, the delegate is a multicast delegate, and can have more than one method attached and this is basicly the reason that it must be void.
Hope it makes sence 
|
|
|
|
|
when more than one delegate is added to an event, they all get fired; which return value would you hope to get?
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
Thx for the quick answer...considering the multicast issue of delegates/events and the reusability of assemblies it makes sense using a void return value...
|
|
|
|
|
you're welcome.
BTW: void is not a value, it is a type (or absence thereof, some would say).
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
Oh...yepp...I know...sorry for my unclear expression...I´m no native English speaker...
|
|
|
|
|
Please help.
I have Page.SmartNavigation = true; in my page load but it does not work' My browser does not maintain its last position after the page refreshes.
|
|
|
|
|
|
Good day
I want to save a video stream to file from my webcam. I looked at Andrew Kirillov's example on "motion detection algorithms" and used the exact same code to test the saving of a video file, but it seams that the writer.Open() method is unable to execute properly.
In my own code (using the "saving video" snippet) I'm given an exception, and when running Andrew's complete source code on the motion detector the program freezes as soon as I start recording.
I am running Vista, so I don't know whether that might be the cause?
This is my code I'm currently using:
SaveFileDialog sfd = new SaveFileDialog( );
if ( sfd.ShowDialog( ) == DialogResult.OK )
{
AVIWriter writer = new AVIWriter( "wmv3" );
try
{
writer.Open( sfd.FileName, 320, 240 );
Bitmap bmp = new Bitmap( 320, 240, PixelFormat.Format24bppRgb );
for ( int i = 0; i < 100; i++ )
{
bmp.SetPixel( i, i, Color.FromArgb( i, 0, 255 - i ) );
writer.AddFrame( bmp );
}
bmp.Dispose( );
}
catch ( ApplicationException ex )
{
lblFps.Text = "Exception thrown";
}
writer.Dispose( );
}
|
|
|
|
|
What kind of exception / what text is in the error?
I are troll
|
|
|
|
|
Dear friends,
please tell me how to change the File summary information ??
My Problem is i have
"own file type"
and i want to change the file summary through c# can u please tell me how to do that?
i mean the file->properties-summary tab information.
please give me any idea? link? or source.
Thank you.
Joe.I
|
|
|
|
|
|
Dear friend
thanks for your replay.
i have asked the question already ??
With Love
joe.I
|
|
|
|
|
hello
I ran into this error message while before/while/after insert into ShopMessage...
<br />
Message "Cannot access a disposed object.\r\nObject name: 'Transaction'." string<br />
I'm using TransactionScope with timeout set to zero (i.e. infinite). Googled a bit still quite clueless.
This is how I wrap Database calls in TransactionScope
<br />
<br />
using (oScope = new TransactionScope(TransactionScopeOption.Required, TimeSpan.FromMilliseconds(0)))<br />
{<br />
nGeneratedId = SaveCoreOperations(ref oShop);<br />
oScope.Complete();<br />
}<br />
Here's the stack trace
<br />
at System.Transactions.Transaction.get_IsolationLevel()<br />
at System.Data.SqlClient.SqlDelegatedTransaction..ctor(SqlInternalConnection connection, Transaction tx)<br />
at System.Data.SqlClient.SqlInternalConnection.EnlistNonNull(Transaction tx)<br />
at System.Data.SqlClient.SqlInternalConnection.Enlist(Transaction tx)<br />
at System.Data.SqlClient.SqlInternalConnectionTds.Activate(Transaction transaction)<br />
at System.Data.ProviderBase.DbConnectionInternal.ActivateConnection(Transaction transaction)<br />
at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)<br />
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)<br />
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)<br />
at System.Data.SqlClient.SqlConnection.Open()<br />
at NHibernate.Connection.DriverConnectionProvider.GetConnection()<br />
at NHibernate.Impl.SessionFactoryImpl.OpenConnection()<br />
Any idea?
dev
|
|
|
|
|
devvvy wrote: SaveCoreOperations(ref oShop);
I don't think you need a ref here.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
yes you're right about not needing the ref, but that's not what i am asking either.
I am suspecting TransactionScope called Transaction.Dispose somehow.
dev
|
|
|
|