|
dude,
i made a 2nd cmdBaseClass now (does not inherit Form)...
now my "GlobalMethodsClass" needs to inherit the "Non Form CmdBaseClass" but GlobalMethodsClass is STATIC... it moans that static classes should inherit from objects
i don't get it? isn't cmdBaseClass an object? i thought EVERYTHING in an OOP language is considered an object
thanx
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
think BIG and kick ASS
you.suck = (you.passion != Programming)
|
|
|
|
|
HarveySaayman wrote: i made a 2nd cmdBaseClass now (does not inherit Form)...
Two classes with the same name ?
HarveySaayman wrote: now my "GlobalMethodsClass" needs to inherit the "Non Form CmdBaseClass" but GlobalMethodsClass is STATIC... it moans that static classes should inherit from objects
If the class is static, then all your methods need to be static. I don't know if you can derive a static class from another.
Nope - static classes cannot have a base class. That does make sense, b/c what's the point of a class having a base, when no instances of that class can ever exist ?
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 )
|
|
|
|
|
Christian Graus wrote: Two classes with the same name ?
nope, one is named "cmdBaseForm" and the other "cmdBaseNonForm"
thanx for the help
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
think BIG and kick ASS
you.suck = (you.passion != Programming)
|
|
|
|
|
OK - so your only problem is that one is static. Just don't make it static, it's just syntactic sugar anyhow, to force you to make all properties/methods static. You can still do that in a non static class.
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!
Is there any way to get the table's definition (SQL Server 2005) in C#?
Regards,
Adeel
Do rate the reply, if it helps or even if it doesnot, because it helps the members to know, what solved the issue. Thanks.
|
|
|
|
|
You can execute stored procedure "sp_tables" through code to get list of tables and "sp_columns @tablename" to get the name type etc of each column of a table.
|
|
|
|
|
Thanks for your reply, but i doubt if they are C# classes/libraries...!
Do rate the reply, if it helps or even if it doesnot, because it helps the members to know, what solved the issue. Thanks.
|
|
|
|
|
These are stored procedures provided by SQL Server to get database and table schemas. You can run these using SQLCommand and read the out come using SQLDataReader class.
|
|
|
|
|
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
|
|
|
|