|
Hi experts
I am using SQL Server 2005
I have Table Having Str. like
__________________________
Heading | Tax
__________________________
A | Taxx
A | Taxz
A | TAXN
B | 10
B | 20
B |30
C |5
C |5
C |4
_____________________________
i Want Result
like
--------------------------------
A B C
----------------------------------
TaxX 10 5
TaxZ 20 5
TaxN 30 4
--------------------------------
this Result in Datagrid view in WinForms
How i get it in Datagrid view
my column A,B,C ,D ..... so on Dynmaic
Dinesh
|
|
|
|
|
Pivots[^]
Education is not a way to escape poverty — it is a way of fighting it.
|
|
|
|
|
You don't even have to leave CP [^] to get a solution
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
How to insert time in oracle database???
|
|
|
|
|
Try this
DateTime.Now.ToString("hhmmss");
If you need AM/PM in time, then use
DateTime.Now.ToString("hhmmsstt");
and also try this link
Datetime in Oracle[^]
Regards,
Karthik K...
|
|
|
|
|
But How insert into database???
|
|
|
|
|
there is no specific question ! what did you try and post what you have done ? Do you need to insert time from c# ?
Connect to the database and try what karthick has suggested.
Education is not a way to escape poverty — it is a way of fighting it.
|
|
|
|
|
I'm tryin' to clone(not really but something like that) a class but it's members always have reference of the source. Here is an example (not exact class but an example)
public class A
{
Bitmap bitmap;
public Bitmap bitmap
{
get{ return bitmap; }
set{ bitmap = value; }
}
public void Fill(A ainst)
{
PropertyInfo[] pi = this.GetType().GetProperties();
for (int a = 0; a < pi.Length; a++)
pi[a].SetValue(this, pi[a].GetValue(source_SI, null), null);
}
}
public class B : A
{
A a_inst;
public B()
{
a_inst = new A();
}
public void Read()
{
bitmap = new Bitmap();
a_inst.Fill(this);
}
}
now, I can't write something like this
bitmap = new Bitmap(bitmap);
because that class have around 100-150 Bitmap objects and other more objects like locations and sizes. And amount of objects can be increase so I want a fix solution like even amount of objects changes it won't effect cloning(Fill()) function. Thats why I wrote above code and its working but with reference...
EDITED :
Well, its not creating reference. I did a little mistake in code.
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
modified on Friday, July 24, 2009 10:08 PM
|
|
|
|
|
Hello,
I am new to C# and I writing an application that uses an Access database. It works fine I can do almost everything I need to do with that database. The database represents one object, lets say "House" for example. The tables represent the different rooms in the house. The items in each room fill the cells in the table.
The problem I am having is that there are several databases "houses", each in their own directory. They each have the same file name. The databases identical except for the data. I want to be able to switch back and forth through them. How can I programatically switch from one Access database in folder A to another Access database in folder B? "House" database name and "Room" tables are just an example.
Any and all help would be greatly appreciated.
Thank you
Kio
modified on Friday, July 24, 2009 9:42 PM
|
|
|
|
|
Kiotaya wrote: The tables represent the different rooms in the house. The items in each room fill the cells in the table.
Why do you need a different table for each room ?
Kiotaya wrote: The problem I am having is that there are several databases(houses), each in their own directory
Your approach seems broken. Why not have a houses table and a rooms table ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Im sorry, I should have explained the name "House" is an example. The actual database name is "Merchant". How do I switch from Access database in folder A to Access database in folder B?
|
|
|
|
|
change your connection string or create a new connection to the other database
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thank you for your response but neither of these options are practicle. I need to be able to programaticlly switch from one database to another.
|
|
|
|
|
Kiotaya wrote: neither of these options are practicle
How on earth do you expect to change the database if you won't change/create another connection.
Create a connection to database A called connA
use it to do something
create another connection to database B called connB
use it to do something in the other database.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
That will not work. I need to know how to switch between databases programatically. All the databases have the same name and tables. Also I may be adding more merchants in the future. I do not want to have to go back and recompile the code everytime I add another merchant.
I would appreciate it of someone could help me with this or point me in the direction of an article that may help answer this.
Thanks
Kio
|
|
|
|
|
You can't have one connection to many databases. (At least with Access.)
Having multiple connections is a way to do this programatically.
How about a Dictionary of connections?
Otherwise you'll need to explain what you need more clearly.
|
|
|
|
|
Thanks but I figured it out myself.
-You can't have one connection to many databases. (At least with Access.)-
-How about a Dictionary of connections?-
-Otherwise you'll need to explain what you need more clearly.-
By using the "xxx.exe.config" file you can change the directory your connection is pointing to. This way I do not have to recompile code everytime I want to add a merchant.
|
|
|
|
|
What so you are going to add a new merchant to your config file every time you expand your base. Your design sucks (sticking with a good CP theme) you need to take a look at the design of your entire solution.
I wrote the above and then sat back and thought maybe it works for you, I'm glad you found a solution although it is not one I would use.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Well why didn't you say that's what you wanted to do in the first place?!
|
|
|
|
|
Hi,
I use reportviewer to display reports in a small application some years ago.
I've implemented it "quick and dirty" and now it's time to clean up
I have seen many samples and walkthroughs but haven't found any that uses untyped dataset or a separate datalayer. One of the things is that I want to avoid adding separate datasets and end up having many .xsd files in my solution.
At this point I'am thinking to try to get everything in a seperated libary and add this to my project. This gives me (I hope) the opportunity to edit the reports and re-add them to my application by overwriting a simple dll at the moment I want.
Is there someone who know a good walkthrough or can give me some sample code to do this.... or can tell me that it's a stuppid idea and knows a beter way to do this.
thanks
|
|
|
|
|
We've all seen applications that display a tray icon, which may or may not redraw itself after killing explorer.exe and then restarting it...the app's still running, but it's not aware that explorer got restarted and so its tray icon is missing...
What's the "clean" way of getting a C# app to look for this so it can take appropriate action? Does Windows broadcast some sort of "shell restarting" notification?
|
|
|
|
|
Hi,
I'm not aware of such explorer events, nor have I ever protected an app against explorer restarts. Here is an idea that might help you:
- on app start, get explorer process ID.
- periodically check it, and on a change, remove your NotifyIcon, then add a new one.
Are you sure this is worth it?
FYI: I wrote an article on stray tray icons once. You could use those techniques to check the presence of (exactly) one NotifyIcon for your app.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Luc Pattyn wrote: - on app start, get explorer process ID.
It's not unusual for me to have multiple instances of explorer.exe running. Unless I can determine which one is drawing the taskbar/systray, a list of explorer.exe process IDs wouldn't tell me much
Luc Pattyn wrote: - periodically check it, and on a change, remove your NotifyIcon, then add a new one.
Yeah...the whole reason I inquired about a notification message is that I'd rather avoid polling...seems like such a waste.
Luc Pattyn wrote: Are you sure this is worth it?
Well, if my app is minimized, the only way you can interact with it is through its tray icon...so, if it disappears, pretty much the only thing you can do is kill it in Task Manager and restart it...
Luc Pattyn wrote: FYI: I wrote an article on stray tray icons once. You could use those techniques to check the presence of (exactly) one NotifyIcon for your app.
Thanks, I'll check it out.
|
|
|
|
|
Not sure about the rest, but unless something changed in Vista/Weven, explorer.exe seems to only run one process, no matter how many instances you have up.
|
|
|
|
|
Ummm...no. I can have multiple instances of explorer.exe showing up in Task Manager, in the Processes tab, each with its own process ID. That's always been the case as far as I can remember.
|
|
|
|