|
dear zhang,
be carfull that when you call connection .close() it will not release the memory but just sleep the connection to the server you can explore you server and find the session available after closeing the connection but to free the memry and release the session to the server you have to call dispose function which will do that
Mhmoud Rawas
------------
Software Eng.
|
|
|
|
|
thanks, but I changed to use dispose function to close the connection, the usage of memory displaying in the task manager is the same.
|
|
|
|
|
zhang_ding wrote:
the usage of memory displaying in the task manager is the same
BTW, that's not the most accurate measurement of application memory use. It doesn't necessarily reflect the actual usage - just the amount assigned to that process.
|
|
|
|
|
I have the standard edition of Visual Studio Net and I am trying to use the report generator from Crystal Reports. I can't find the report template when I try to add it as a new item. Is it not included with the standard edition or something?
If I want to make a report from a database, why would I not try to automate Access to do it? I've never done such a thing, but the book says you can do it. Is it something that is very cumbersome or something?
Thanks,
martinkilgore933#takethisout#@hotmail.com
|
|
|
|
|
When we use the SqlConnection,It has a Attribute named "Connectionstring".if we Click the Attribute and Select "new connection". A Form will popup.
The Question is : How can I use the "Poupup Form" in my Customer Control??
|
|
|
|
|
This is a designer interface. In order to use the designer interfaces, you have to host the designer. Even then, the designer in this case is Visual Studio .NET, so you won't be able to use the implementation. Some designer interfaces are in the .NET Framework itself (the BCL), but this one is not. The best you can do is develop something similar.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
This is not really what you want but you can still achieve a similar thing like this:
Add reference to
- Microsoft ActiveX Data Objects 2.7 Library
- Microsoft OLEDB Service Component 1.0 Type Library
In your code add this:
ADODB.Connection conn = new ADODB.ConnectionClass();<br />
MSDASC.DataLinks dLinks = new MSDASC.DataLinksClass();<br />
object cn = (object) conn;<br />
dLinks.PromptEdit(ref cn);<br />
string myConnStr = conn.ConnectionString;
The connection string returned cannot be used with SqlConnection. What you need to do is to parse the string and remove any occurence of Provider=SQLOLEDB.1 in order to pass this connection string to your SqlConnection. If you forget this, you will be blessed with the Exception.
Enjoy
|
|
|
|
|
Can anyone tell me how to fix a problem with the Windows Form Designer disapearing from a class after copying a class from one project to another?
I have had this happen a couple of times. I want to steal a forms class from an existing project to use in a new project. I copy both the .cs and rex files from one project directory to annother and then use the "Add Existing" option in Visual Studio to add the form code to the project fixing the namespace appropriately.
The project compiles fine and runs fine. The form works but does not show up as a form in the Solution Explorer. And, when you try to open the form in the forms designer, all you get is source coded, no visual interface.
Everything works, but you can't use the designer to work on the form.
I've looked at the source code for a new form and compared it to the old form and I don't see any differences. Can anyone shed any light on this issue? It's a pain...
Thanks...
|
|
|
|
|
that happens when u have more than one "root" class in a file.
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
VS.NET, for some reason, thinks that your code file does not contain a designable class. This can be for a number of reasons: most likely, you've got a class defined in that file before the Form-derived class.
To fix this, open up the .csproj file and look for the element
<File
RelPath = "YourFile.cs"
SubType = "Code"
BuildAction = "Compile"
/>
and change it to:
<File
RelPath = "YourFile.cs"
SubType = "Form"
BuildAction = "Compile"
/>
After that, open up this .csproj file in studio again, and it should show that file as a Form-derived class and allow you to open it with the Form Designer
--
Russell Morris
"So, broccoli, mother says you're good for me... but I'm afraid I'm no good for you!" - Stewy
|
|
|
|
|
hello, it's possible to load data from xml file, and then save it in database table, both data structures are the same, has xsd file definition?
see ya,
KrisPL
krzysztofo@poczta.onet.pl
|
|
|
|
|
|
i have an xml file generated by my program ex.:
<records>
<record id="1" name="test" date="2003-11-17" />
<record id="2" name="test2" date="2003-11-16" />
</records>
and Database table Table1 with structure:
id, int
name, varchar(50)
date, datetime
i want to store this data in database, i can do that by reading rows, step by step, but i search for some basic method, by using DataSet and DataAdapter (i think), i'm using DataSet.ReadXml method to read data from xml file but i don't know how to store it in db table, i were try methods DataAdapter like FillSchema ect. but i fill like blindman in this topic.
KrisPL
krzysztofo@poczta.onet.pl
|
|
|
|
|
I can't come up with a quick concise code sample to answer your question so instead I'm going to run over the basic methodology real quick and then you should be able to transfer it to code.
1) Create a SQL Connection to your database
2) Create an Sql DataAdapter object on that connection. Make sure that you include a proper select all statement (SELECT * FROM Table1)
3) Create a DataSet object.
4) Fill the DataSet using the SqlDataAdapter object.
5) Now read in the xml file into that DataSet into the table Table1
6) Now use the update method (SqlDataAdapter or on the DataSet) to write the information back to the database
Jared
jparsons@jparsons.org
www.prism.gatech.edu/~gte477n
|
|
|
|
|
ok it helps me a bit, i try this before, but i make one mistake on this, i were read xml file to ds hefore i were read it from database (i mean da.fill), so my parts looks like:
XML File:
<records>
<sqlTableName id="1" name="osin" date="2003-01-02" />
<sqlTableName id="2" name="josin" date="2003-01-04" />
</records>
and i have sqlTableName
id, int (PK)
name, varchar(50)
date, datetime
and this code:
SqlConnection conn = new SqlConnection("Server=(local);" +
"Integrated Security=SSPI;" +
"database=UniconDataCenter");//use own database
SqlDataAdapter da = new SqlDataAdapter("select * from sqlTableName",conn);
conn.Open();
da.Fill(ds,"sqlTableName");
ds.ReadXml(Server.MapPath("") + "/test.xml"); //an XML file with data to store in database
//it must be because update command use an insert command
da.InsertCommand = new SqlCommand("INSERT INTO sqlTableName (id, name, date) VALUES(@id, @name, @date)", conn);
da.InsertCommand.Parameters.Add("@id", SqlDbType.Int);
da.InsertCommand.Parameters.Add("@name", SqlDbType.VarChar,50);
da.InsertCommand.Parameters.Add("@date", SqlDbType.DateTime);
da.Update(ds, "sqlTableName");
the problem is: after readxml it get's rows collection, and fill itemArray in the row, but all of it have System.DBNull value, so after ds.Update method it response with error because id is primarykey and can't have null value.
so my next step were to reconfigure xml file, so now it's look like this:
<records>
<sqlTableName>
<id>1</id>
<name>osin</name>
<date>2003-01-04</date>
</sqlTableName>
</records>
and wow, now i have vales in itemsArray ow rows collection, but i still have an error:
System.Data.SqlClient.SqlException: Prepared statement '(@id int,@name varchar(50),@date datetime)INSERT INTO sqlTableNa' expects parameter @id, which was not supplied.
so, any idea
KrisPL
krzysztofo@poczta.onet.pl
|
|
|
|
|
ok, was eat this sh..., the problem was with buid insert command, so i have read some help in different example and there MS says:
use SqlCommandBuilder without this doesn't work, so i've replace my insert command with:
SqlCommandBuilder cmdb = new SqlCommandBuilder(da);
da.InsertCommand =cmdb.GetInsertCommand();
and it's work,
but i have second problem:
i can't fill dataset with xml data stored in file with this format:
<record id="1" name="test" data="2003-01-02" />
it read all fields as null
only this format are good:
<record>
<id>1</id>
<name>test</test>
<data>2003-01-02</data>
</record>
so maybe, somebody know - if it's possible - how to read data as attributes of xml data
KrisPL
krzysztofo@poczta.onet.pl
|
|
|
|
|
I declare a new thread as a class variable
Thread myThread = new Thread(new ThreadStart...);
I call .Start() on the thread and it works fine. However, if I call .Start again on the thread, even after the thread is done executing, an exception is thrown. It seems I have to reinstanciate the thread every time I want to use it. Is this the case or am I missing something?
The graveyards are filled with indispensible men.
|
|
|
|
|
Judah H. wrote:
It seems I have to reinstanciate the thread every time I want to use it. Is this the case or am I missing something?
Yes - I'm pretty sure you have to re-instantiate it. If you don't want to do that, you can create a message queue like the Windows message queue and post messages to it.
|
|
|
|
|
Hmm seems like overkill to me - why have the C# designers forced us to reinstantiate the thread? Provided the thread is stopped or aborted, shouldn't we be able to restart it?
I appreciate the information, though, thanks.
The graveyards are filled with indispensible men.
|
|
|
|
|
No, not necessarily. A thread is created as a temporary execution block for your processor. The Thread class is just a wrapper for that. The documentation states such.
You should look into the ThreadPool and worker threads. The previous poster mentioned to use a similar concept, but why write your own when one already exists with a lot of features. The ThreadPool also limits the number of concurrent threads so your application doesn't hog all the system resources, which is usually a good thing (unless you're attempting real-time execution).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Can someone provide some sample code on how to bind to a checkedlistbox to an arraylist? My situation is I have a checklistbox on a form and a method that returns an arralylist in another class. How can I bind the arraylist in one class to the checkboxlist form in another class?
|
|
|
|
|
To be honest, i'm a bit surprised that CheckedListbox doesn't expose DataSource and others. I'm sure there's a better answer, but at the least you can use it's base class' methods:
ArrayList list = new ArrayList();
list.Add("Hello");
ListBox box = (ListBox)checkedListBox1;
box.DataSource = list;
|
|
|
|
|
Is there any way in C# or other languages to detect the dependent DLLs of an existing non-DotNET DLL (regular DLL)? For i.e. if XXXX.DLL is using AA.DLL and BB.DLL, the last two DLLs are detected by the small piece of code after passing XXXX.DLL name.
Thank you.
Arash Sabet
Computer Engineer
E-mail: afifi@sympatico.ca
|
|
|
|
|
There is no reason to repost your problem.....
You will need to look at dependancy walker or something like that, or read the import table of the dll. Ask in C++ forum, and find out what to do, and the use pinvoke.
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
Thanks, I was about to reply the same way about the repost.
Since he originally didn't state which DLLs he meant, I replied with regard to dependent assemblies. But in either the case of IL or Win32 modules, this information is not in the import table. It is contained in the assembly manifest and requires that the manifest be read and parsed. If you run depends on most assemblies (barring some of the lower-level BCL assemblies like mscorlib), the only libary in the import table is mscoree, despite whatever externally or internally referenced modules are in the manifest.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|