|
The Connection object provides you the "GetSchema()" method, which returns a DataTable filled with schema informations.
You have to specifiy what information you want in parameters of the method.
Example:
<br />
DataTable _indicesSchema = null;<br />
using (OleDbConnection connection = new OleDbConnection("Provider=SQLOLEDB;Password=******;Persist Security Info=True;User ID=sa;Initial Catalog=*****;Data Source=*******"))<br />
<br />
connection.Open();<br />
<br />
_indicesSchema = connection.GetSchema("Indexes", new string[] { null, null, null, null });<br />
<br />
connection.Close();<br />
<br />
}<br />
Hope was helpfull
Tiefe Brunnen muss man graben wenn man klares Wasser will,
tiefe Wasser sind nicht still.
|
|
|
|
|
Take a look at the GetSchema command on your connection object. It has all sorts of useful abilities for retrieving information about the database. I mention this one rather than directing you towards particular tables/stored procedures in the database because it gives you the option to discover information from lots of different database types.
|
|
|
|
|
How do i export the data from grid view to csv file in c#
|
|
|
|
|
Does this works?
StreamWriter oWriter = new StreamWriter("CSV File Path", false);<br />
for(int i = 0; i < oGridView.Columns.Count; i++) {<br />
oWriter.Write(oGridView.Columns[i].HeaderText);<br />
if(i < oGridView.Columns.Count - 1) {<br />
oWriter.Write(",");<br />
}<br />
}<br />
oWriter.Write(oWriter.NewLine);<br />
foreach(DataGridViewRow dr in oGridView.Rows) {<br />
for(int i = 0; i < oGridView.Columns.Count; i++) {<br />
oWriter.Write(dr.Cells[i].Value.ToString());<br />
<br />
if(i < oGridView.Columns.Count - 1) {<br />
oWriter.Write(",");<br />
}<br />
}<br />
oWriter.Write(oWriter.NewLine);<br />
}<br />
oWriter.Close();
modified on Wednesday, May 14, 2008 4:24 AM
|
|
|
|
|
Hope this will help you :
private void OnExportGridToCSV(object sender, System.EventArgs e)
{
StreamWriter sw = new StreamWriter(Server.MapPath("~/GridData.txt"), false);
DataTable dt = m_dsProducts.Tables[0];
int iColCount = dt.Columns.Count;
for(int i = 0; i < iColCount; i++)
{
sw.Write(dt.Columns[i]);
if (i < iColCount - 1)
{
sw.Write(",");
}
}
sw.Write(sw.NewLine);
foreach (DataRow dr in dt.Rows)
{
for (int i = 0; i < iColCount; i++)
{
if (!Convert.IsDBNull(dr[i]))
{
sw.Write(dr[i].ToString());
}
if ( i < iColCount - 1)
{
sw.Write(",");
}
}
sw.Write(sw.NewLine);
}
sw.Close();
}
|
|
|
|
|
Hi Friends,
I need to unzip the Images in C#.Please help me how to do?
Thanks & Regards
Senthil Kumar.T.S
|
|
|
|
|
What is inside a zip is completely irrelevant.
I believe the newer versions of C# have zipping built in, there are libraries you can buy and there's a library in J# that is widely documented for use in C#.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi Christian Graus,
Inside Zip having image files.how to unzip the images files.
|
|
|
|
|
Good god.
Read the article I link to in my sig. Read my answer - it doesn't MATTER that they are image files. Then see if once you've read my articles, you can come up with a better result than this[^].
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
You had asked about unzipping zip file yesterday. Why not try solutions offered on a zip file having images. It will work.
|
|
|
|
|
1. Stop asking the same question again.
2. If someone gives you an answer, don't just ask the question again.
Does it matter what I write here? Someone just has to say something about it.
|
|
|
|
|
Hi everybody,
I can't drag&drop a file from out the explorer into my application.
I read already some articles about the UIPI and tested some workaround.
I even used the ChangeWindowMessageFilter (from user32.dll) to accept the WM_DROPFILES.
This function returns 1, which means that the MessageFilter is correctly affected.
But the user still can't drag & drop.
So a ChangeWindowMessageFilter isn't enough to accept messages from a process with
a lower integrity level.
Does any one have an idea?
Big thanks !
|
|
|
|
|
Hi baerten,
I have exactly the same issue on my Vista.
Do you have a solution since your post ?
Fred
|
|
|
|
|
Hi,
does it not work on the developper machine while debugging or on a real machine?
If it's on a standard computer, without visual studio, for example for your customer:
Does he start the exe with Administrator Rights ?
Greetings
|
|
|
|
|
Hi Baerten,
Sorry, I was on vacation.
It doesn't work on any machine.
And effectively, my process is launched as a High Level integrity process.
I've tested to modify filter with added support to WM_DROP_FILES but it still doesn't work.
Do you have any solution since ?
Greetings
Fred
|
|
|
|
|
Is it really needed to start the application as an administrator?
I changed my project to work around this problem.
I wrote some user-preferences into the registry.
Under XP -> No problem
Under Vista does the application beeing started with admin rights, only as admin
you can write into the registry. But as an admin you have running your application
as a High Level Process --> NO DRAG DROP
I tested some work arounds. For example "ChangeWindowMessageFilter(WM_DROPFILES, MSGFLT_ADD);"
But no effect.
So i changed my application that it could be startet without Admin-Right ... and it works now
Greetings
|
|
|
|
|
Ok, thank you Baerten.
For now, i can't work on my app to run it without high IL, but this is the way.
Greetings
|
|
|
|
|
Hi all,
how to draw text in richtextbox..?
%#&kmpYrlHSGYG5@#($_+!@!(*JASnjshdk,cm_0ashjhdbn@#$!48mkhfbchsh))^%#W%&@YW7wsdfjw789';'][]\`~JKJQ4$!@#~)-HSKS^&*1)JK12@#@$~!1`DFGkqp][]\]?Zas;EWRG%!@~)(^&BVAG
|
|
|
|
|
What do you mean, draw ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I need input file using openfiledialog method.
Inside that file i did simulation command.
So i only need retrieve few command from that file into richtextbox.
My problem now,i cant retrieve any command from that file..
The command is in text format..
%#&kmpYrlHSGYG5@#($_+!@!(*JASnjshdk,cm_0ashjhdbn@#$!48mkhfbchsh))^%#W%&@YW7wsdfjw789';'][]\`~JKJQ4$!@#~)-HSKS^&*1)JK12@#@$~!1`DFGkqp][]\]?Zas;EWRG%!@~)(^&BVAG
|
|
|
|
|
I don't know whaty ou mean by 'retrieve command'
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hello,
Let's say there are one ToolstripStatusLabel and ToolstripProgressbar in Statusbar.. I have set the width of label explicitly. I want to show the progressbar in the rest of area without setting width explicitly..
For example:
[statusbar with Dock=Bottom]
[label width="200"]
[progressbar width="*"]
[/statusbar]
How can I do that?
I'm using VS 2008 for winform..
|
|
|
|
|
Hi to all,
I want to show a (Crystal) Report in C#.
But I am not planning to use database.
So can I create/show a Report using XML or Array Data using Crystal Report or other tool in C#?
Thanks & Regards,
Aniket A. Salunkhe
|
|
|
|
|
I'm pretty sure Crystal Reports supports XML asa data source, although I have not use it for serveal years so I may be wrong
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Thanks for your reply.
I will try it.
|
|
|
|