|
Hi
EVerything is correct in my code This code retives after particluar selection from listbox.
I have to dynamically retrive all databases and tables names and columns names of local host
in single connection. These all names will be storeed into xml file
i think i will have to use jagged array.
How can i store all the adatabaes names ,tables names and columdn names in jagged array so that i can store into xml file
can someone integrate all the sql statement in single SqlConnection statement
using Jagged array or something better from the view of Optimization
regards
sanjeev
|
|
|
|
|
Use the code in:
button3_Click
To create a method:
StringCollection GetDatabaseNames() This method should return all the database names.
Use the code in:
button4_Clic
To create a method:
StringCollection GetTableNames(string dbName) This method should return all tables for a specific database name.
Use the code in:
button5_Click
To create a method:
StringCollection GetColumnNames(string dbName, string tableName) This method should return all columns for a specific database/tablename combination.
I won't go into xml details but following is a pseudo-code of what your code should look like:
StringCollection databases, tables, columns;<br />
databases = GetDatabaseNames();<br />
foreach (string dbName in databases){<br />
tables = GetTableNames(dbName)<br />
foreach (string tableName in tables){<br />
columns = GetColumnNames(dbName, tableName)<br />
foreach (string columnName in columns){<br />
<your code to store in xml><br />
}<br />
}<br />
}
|
|
|
|
|
Reposting: I got no response in ASP.Net forum.
Hello everyone,
I have a question on using code-behind page-level static class members to preserve page-level data during click events and/or page refreshes. For example, if I have something like:
<code>
public class MyPage : System.Web.UI.Page
{
private static MyDataObject m_data;
private void Page_Load(object sender, System.EventArgs e)
{
if( !IsPostBack )
m_data = LoadMyData();
}
private void SaveButton_Click(object sender, System.EventArgs e)
{
}
}</code>
I'm hoping that when the user clicks to some other page on my website that this m_data object will be released from memory. And, I'm also hoping that if I have many people accessing this page at the same time, that each page will have its own m_data object created so that each user sees their properly loaded data.
Am I going about this wrong? Is there a better way? I've heard that page-level caching does not scale well in web farms, etc., so I'm trying to avoid that type of solution.
Thanks in advance,
~Brad
|
|
|
|
|
If you know when ASP.NET creates and destroys AppDomains for your webapp, you'll have the answer to this question also ( I don't). Static variables are static within their appdomain, so if ASP.NET maintains one AppDomain per webapp, then the static variables will be shared across pages.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
So basically, if 20 people are hitting that particular page, then they're all using the same static variable. Hrm. Not good.
|
|
|
|
|
Ask in the ASP.NET forum, you'll get more answers there.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Luis,
If you'll notice at the top of my original post, "Reposting: I got no response in ASP.Net forum."
Thank you.
|
|
|
|
|
I know this has to do with threading but I can't seem to get my head around the right way to do this. Originally I was doing this:
private void button1_Click(object sender, System.EventArgs e)
{
SpecialForm.SpecialForm infoBox;
infoBox = new SpecialForm.SpecialForm();
infoBox.setText("BlahBlah");
Thread.Sleep(5000);
infoBox.Close();
}
Which does not work...so I tried puttin it all in a seperate thread and it still does not work. Can anyone help?
-dustin
|
|
|
|
|
Also the SpecialForm is just a form that fades in and fades out when creating and closed. Also has to two methods, one for changing the text in a label and the other for updating a graphic in a pictureBox. It works fine when I get rid of the Thread.Sleep(5000) and the infoBox.Close() and put the infoBox.Close in another button. But of coarse that is manually closing it I need it to close itself after a certain amount of time.
|
|
|
|
|
You need to call BeginInvoke if you accessing the form from a different thread. See this[^] article to know more about BeginInvoke . The code to do what you want will look like
private void ThreadFunc()
{
Thread.Sleep(5000);
infoBox.BeginInvoke(new MethodInvoker(infoBox.Close(), null);
}
This will Close on the UI thread after 5 seconds. Hopefully that'll solve your problem.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Use a Timer object, and on the Tick event, close the form. Enable the timer in the constructor, and set its interval to 5000 ms.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Hi,
I would like to know how I can use document variables in C#.
I want to create a variable and store a string in it, then open the word document and retrieve the value of that variable.
Can anyone help me?
Thanks!
|
|
|
|
|
Hi ever body,
My question is how we can pass a string variable from c# project to a DLL using a matlab application. i shearched in Mx library and Mat libraries but i didn't found .
Thank u for ur help
|
|
|
|
|
I do it all the time. Just use the EngMATLib. Actually it's on this site!
1..2..3 ways of integrating MATLAB with the .NET[^]
I can pass a string like this to make a 3x3 matrix in matlab...
using (EngMATAccess mat = new EngMATAccess())
{
mat.Evaluate("A = [ 1 2 3; 3 5 6]"));
}
/\ |_ E X E GG
|
|
|
|
|
How we can do it in using DLL to call a matlab application?
|
|
|
|
|
Hi Guys , i want one help Regarding OPSEC SDK.
Open Platform for Security SDK is provided by Check point server which contains API's written in C also it contains many header files dlls etc..
I am new to C language and donot know how can i use the functions etc.. in C# with the matching datatypes....
Can anybody help me for writting the warpper class for it
Thanks and Regards,
Nitin.
|
|
|
|
|
|
Hi,
I've a problem with my image.
I use a function which take a .tif image with 128 colors input.
But I don't know how convert an image in 128 colors.
Do u have any ideas?
Thx for replies
Have a nice day
bibax en fait un max!
|
|
|
|
|
Hi,
I found how convert my image in 128 colors (2^7)
This is my code :
ImageCodecInfo myImageCodecInfo;
Encoder myEncoder;
EncoderParameter myEncoderParameter;
EncoderParameters myEncoderParameters;
//chnage the filename to obtain a tif file
Console.WriteLine(rasterFileName);
int index = rasterFileName.IndexOf(".");
string rasterFileNameTif = rasterFileName.Substring(0,index);
rasterFileNameTif = rasterFileNameTif.Insert(index, ".tif");
Console.WriteLine(rasterFileNameTif);
try
{
// Get an ImageCodecInfo object that represents the TIFF codec.
myImageCodecInfo = GetEncoderInfo("image/tiff");
// Create an Encoder object based on the GUID
// for the ColorDepth parameter category.
myEncoder = Encoder.ColorDepth;
// Create an EncoderParameters object.
// An EncoderParameters object has an array of EncoderParameter
// objects. In this case, there is only one
// EncoderParameter object in the array.
myEncoderParameters = new EncoderParameters(1);
// Save the image with a color depth of 7 bits per pixel (128 colors).
myEncoderParameter = new EncoderParameter(myEncoder, 24L);
myEncoderParameters.Param[0] = myEncoderParameter;
Console.WriteLine(myEncoder);
picChart.Image.Save(rasterFileNameTif,myImageCodecInfo,myEncoderParameters);
It works with all formats input
But when I have a tif file input (I want also tif output but in 128 colors), I have an exception :
System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.
at System.Drawing.Image.Save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams)
at displayRaster.displayRaster.ChangeRasterFormat() in c:\documents and settings\franck\mes documents\visual studio projects\displayraster\displayraster.cs:line 178
Do u know why?
Thx for replies.
Have a nice day
bibax en fait un max!
|
|
|
|
|
Hi,
I have a windows service in C# (.NET framework 1.1) running on Windows XP
PRO SP2. This service essentiallt starts a printjob watcher. Please see the code
snippet below.
queryInterval = ((SchedulerData)obj).Interval/1000;
//queryInterval=1;
this.printEventWatcher = new System.Management.ManagementEventWatcher();
this.printEventWatcher.Query = new System.Management.EventQuery("SELECT *
FROM __InstanceCreationEvent WITHIN "+queryInterval+" WHERE TargetInstance
ISA \"Win32_PrintJob\"");
string hostName = Dns.GetHostName();
this.printEventWatcher.Scope = new
System.Management.ManagementScope("\\\\"+hostName+"\\root\\CIMV2");
printEventWatcher.EventArrived+=new EventArrivedEventHandler(this.Arrived);
printEventWatcher.Start();
This service fires the EventArrived event when running as my login account.
i.e When the service is run as MaxBici and I login as MaxBici and print
documents, I see the events being fired.
But, when the service is run as NT AUTHORITY\SYSTEM (Local System account),
and I login as MaxBici and print documents the EventArrived event is not
fired.
The query interval was set to 1 second in both the above cases.
Could anyone help me with this?
What does the scope in the event watcher signify?
Isn't the data in the WMI tables visible to all users in a PC?
Thanks in advance.
Max
|
|
|
|
|
could u tell me about Integrated Security=SSPI, what is the role in database connection
|
|
|
|
|
|
|
hi guys, could you tell me how i can add uninstallation way to the setup project, i want to able the users of my project to uninstall it from the program menu not from add remove programs from the control panel ... how i can add it to my setup project ... thanks alot
Thanks alot
Hamody
|
|
|
|
|
Is it possible to open a printer directly connected to the "Lpt:" port on a Windows XP system? I have a form that must be set up exactly on an old dot-matrix printer, and then printed after filling in some values. I would like to open the printer and send ASCII characters to the device.
Is this possible???
Thanks
XamIam
max@maxpcsupport.com
|
|
|
|