|
Hi,
I have a dll called dllexample.dll, a public function called 'demofunction' in it
i reffer the dllexample.dll to my form and allocate 'demofunction'
demofunction df = new demofunction();
after some time i need to kill the 'df', also need to allocate again if requried
This is the real requirement..
Thankyou
|
|
|
|
|
That sounds very normal - no AppDomains required. Just do what the others suggested (let the GC take care of it or implement IDisposable)
|
|
|
|
|
it still not working....
code in my dll
private bool disposed = false;
public void Dispose(bool disposing)
{
if (!disposed)
{
if (disposing)
{}
disposed = true;
}
}
public void Dispose()
{ Dispose(true);
GC.SuppressFinalize(this);
}
~ListenDesktop()
{
Dispose(false);
}
in my form :
------------
ListenDesktop lt = new ListenDesktop()
lt.Dispose();
but still the 'lt' is active.
I dont need 'lt' no longer in my form.. how can i solve it?
|
|
|
|
|
I'm not sure..
You could use FxCop to check it - it will make a warning if it isn't correct.
|
|
|
|
|
I have tried with the following parameterised query for select statement and is working fine.
SqlCeConnection conn;
SqlCeCommand comm;
comm = new SqlCeCommand();
comm.Connection = conn;
comm.CommandText = "select * from signuptbl where username =@uname";
SqlCeParameter para = new SqlCeParameter();
para.ParameterName = "@uname";
para.Value = textBox1 .Text ;
comm.Parameters.Add(para);
Now i want to write an update query which takes multiple parameters. I have thought of the following code.
SqlCeConnection conn;
SqlCeCommand comm;
comm = new SqlCeCommand();
comm.Connection = conn;
comm.CommandText = "update signuptbl set firstname=@fname,lastname=@lname,,psw=@psw1 where username =@uname";
SqlCeParameter para = new SqlCeParameter();
para.ParameterName = "@uname";
para.Value = textBox1 .Text ;
comm.Parameters.Add(para);
para.ParameterName = "@psw";
para.Value = textBox2 .Text ;
comm.Parameters.Add(para);
para.ParameterName = "@fname";
para.Value = textBox3 .Text ;
comm.Parameters.Add(para);
para.ParameterName = "@lname";
para.Value = textBox3 .Text ;
comm.Parameters.Add(para);
I have tried this code but the row was not updated.
Is this a proper way? How to pass multiple parameters in a query? Can i get a sample code for the same.
Thanks in advance..
|
|
|
|
|
You have created only one parameter and overwriting it's properties each time. You need separate SqlCeParameter instances for each parameter.
comm.Parameters.AddWithValue("@uname",textBox1 .Text);
comm.Parameters.AddWithValue("@psw",textBox2 .Text);
... AddWithValue[^] will create SqlCeParameter internally and add it to the Parameters collection.
|
|
|
|
|
An easy way is to only pass one string that is the full query.
You simply construct it by using variables in C# to read the input and then adding it to the query string.
You might have to add brackets and commas to the query string after the variables have been added.
|
|
|
|
|
Worst answer you could have given, you've just told the OP to take aa step backwards to dynamically-built sql queries rather than using parameters.
You should read up on SQL Injection attacks.
|
|
|
|
|
In most of my code I pass the parameters as a variable to another function which would make the code look like this:
SqlCeParameter[] sqlParams = new SqlCeParameter[4];
sqlParams[0] = new SqlCeParameter("@uname", textbox1.Text);
...
comm.Parameters.AddRange(sqlParams);
hmmm pie
|
|
|
|
|
Hi,
I connect a TcTcpChannel by using the following code
chan = new TcpChannel(400);
ChannelServices.RegisterChannel(chan);
RemotingConfiguration.RegisterWellKnownServiceType(Type.GetType("ScreenCapture, ScreenCapture"), "MyCaptureScreenServer", WellKnownObjectMode.Singleton);
i how can i disconnect it in a click event?
Regards,
YP
|
|
|
|
|
|
plz help
i have a code for datagrid and i want to update it. it shows error
"Specified argument was out of the range of valid values. Parameter name: index."
plz check errors
try
{
ErrorMessage.Text = "";
SqlCommand updCommand = new SqlCommand();
updCommand.Connection = cnx;
updCommand.CommandText="UPDATE Student_Attendance Set Course_Id='" + ((TextBox)e.Item.Cells[3].Controls[0]).Text
+"',Std_Id='"+((TextBox)e.Item.Cells[4].Controls[0]).Text
+"',Class_Id='"+((TextBox)e.Item.Cells[5].Controls[0]).Text
+"',Total_Lectures='"+((TextBox)e.Item.Cells[6].Controls[0]).Text
+"',Attended_Lectures='"+((TextBox)e.Item.Cells[7].Controls[0]).Text +"'";
updCommand.CommandType=CommandType .Text;
cnx.Open();
updCommand.ExecuteNonQuery();
da1.Fill(ds);
Cache["studentdata"]=ds;
DataGrid1.EditItemIndex= -1;
bindGrid();
cnx.Close();
}
catch (System.Exception ex)
{
ErrorMessage.Text=ex.Message;
}
|
|
|
|
|
check whether a column exist in the given index.. It says that the collection object doesn't have any items for your given index..
|
|
|
|
|
hello
When i excute this command in MS-dos:
U:\\convert C:\\ARV\\pdf\\70863).pdf C:\\ARV\\jpeg\\70863).JPEG
it work, but when i do this:
<br />
Process.Start("U:\\convert C:\\ARV\\pdf\\70863).pdf C:\\ARV\\jpeg\\70863).JPEG ");<br />
there an error : the file is not found ,
Thank you verry mutch
|
|
|
|
|
C:\\ARV\\pdf\\70863).pdf and C:\\ARV\\jpeg\\70863).JPEG are args?
try
Process.Start("U:\\convert","C:\\ARV\\pdf\\70863).pdf C:\\ARV\\jpeg\\70863).JPEG");
|
|
|
|
|
ProcessStartInfo psi = new ProcessStartInfo(@"cmd.exe", @"/c dir c:\ /s");
Process.Start(psi);
|
|
|
|
|
What is the step to run a class library?
if my starting form is: Form1.cs
Can teach me?
Thank you
|
|
|
|
|
Applications run, class libraries don't. You can create an "exe" that will load your class-library and then shows your Form1.
Is there a particular reason why your project needs to be a class-library? If not, you can simply change the project type by changing the properties of the project. (Right click on your projectname in the solution-explorer, click properties, open the tabpage "Application" and change the "Output type" to "Windows Application")
Or,
Create a new application, reference your class-library and start your form from there.
Good luck
I are troll
|
|
|
|
|
How to do this?
Create a new application, reference your class-library and start your form from there.
I need to use class library as i need to generate html to pdf.
Which i still finding help with
Thank you
|
|
|
|
|
1. Start Visual Studio
2. Open your project (Ctrl-Shift-O)
3. Go to the solution-explorer (Ctrl-Alt-L)
4. Right-click with your mouse on the node called "References".
5. From the popupmenu, select "Add Reference"
6. Go to the tabpage called "Browse", and locate your "assembly.dll" file.
Now you got the reference to the assembly, and you're set up to use any Forms defined in that library in your application.
You can "use" libraries in your project, you just can't "start" them like you would start, say, Microsoft Word.
YiXiang_89 wrote: I need to use class library as i need to generate html to pdf.
Any prior experience there?
I are troll
|
|
|
|
|
That quetsion sounds supsiciously like a homework and you have no idea how to do it, but are too lazy to even give it a try.
Anyway, I don't know how to debug libraries and I don't think it's possible.
You need to make some kind of test program where you reference the dll and which test its methods.
modified on Friday, March 6, 2009 6:03 AM
|
|
|
|
|
I have my excel addin project written in c#, i would like to generate an MSI for this. How can I achieve that?
Thank you.
|
|
|
|
|
Create a setup and deployment project. and overrride the Installer class..
There you get the necessary methods to install, commit , or rollback the installation.
i belive the namespace is System.Configuration.Install
modified on Wednesday, March 4, 2009 5:31 AM
|
|
|
|
|
i already have my project developed as a new project--> extensibility--> visual studio add-in
I want to build an MSI of this existing project. Am sorry but, did you mean I should create a new project which is a setup and deployement project?
thank you.
|
|
|
|
|
please if any suggetion ssend for me in project in c#
|
|
|
|