|
create Proc [dbo].[sp_Deneme]
as
Begin
select * from Rehber
End
hey friend..i use that procedure to get datas and i tried like that and it worked..
cmd = new SqlCommand("sp_Deneme", conn);
cmd.CommandType = System.Data.CommandType.StoredProcedure;
conn.Open();
reader = cmd.ExecuteReader();
while (reader.Read())
{
label1.Text = reader.GetInt32(0).ToString();
label2.Text = reader.GetString(1);
label3.Text = reader.GetString(2);
}
vemedya.com
|
|
|
|
|
|
No comment on SELECT * ?
And what about numbered fields as in GetString(1) ?
|
|
|
|
|
Luc Pattyn wrote: No comment on SELECT * ?
I use that all the time.
Luc Pattyn wrote: GetString(1) ?
Eh, yeah, I never use the Get methods, I generally just cast to the type, but whatever; it's better than it was.
|
|
|
|
|
if the fields get reordered, the code breaks.
which wouldn't happen when the fields were named explicitly: SELECT fieldName1,fieldName2,fieldName3 ...
The alternative is more cumbersome: reader.GetString(reader.GetOrdinal("fieldName2"))
|
|
|
|
|
Luc Pattyn wrote: if the fields get reordered
Who'd do a silly thing like that?
IDataReader fields can be accessed by name too.
Item [([(String ])]) Gets the column with the specified name. (Inherited from IDataRecord.)
This is from the WCF experiment I was playing with last spring:
dr = this.con.ExecuteReader
(
@"
SELECT *
FROM JunkName
WHERE Id=@Param0
"
,
ID
) ;
if ( dr.Read() )
{
result = new Junk.Types.Record()
{
ID = (System.Guid) dr [ "ID" ]
,
LastName = (string) dr [ "LastName" ]
,
FirstName = (string) dr [ "FirstName" ]
,
Gender = (Junk.Types.Gender) (byte) dr [ "Gender" ]
,
FavouriteColour = Colour.Parse ( (string) dr [ "Colour" ] )
,
Created = (System.DateTimeOffset) dr [ "Created" ]
} ;
}
|
|
|
|
|
PIEBALDconsult wrote: reordered. Who'd do a silly thing like that?
Could happen by accident, after a refactoring; or maybe a convoluted backup/restore operation.
PIEBALDconsult wrote: IDataReader fields can be accessed by name too.
Sure, that is what you and I would do. All but referring by ordinal. So I did expect your objection to it.
|
|
|
|
|
Luc Pattyn wrote: I did expect
I try to do the unexpected and not the expected -- much like the Spanish Inquisition... oh, but maybe you expected that.
|
|
|
|
|
PIEBALDconsult wrote: maybe you expected
you'll never now.
|
|
|
|
|
Hi
I am working on Windows 7 x64, VS2008, FW 3.5, C# only.
I have developed a pretty complex GUI User Control, involving many UserControls planting inside table layout with in table layout with in tab layout control etc.
When starting my form, holding my complex User Control, in maximize mode all looks fine.
When starting to shrink it and then resize it (dragging the mouse from bottom right corner...) the 'deep' user controls and their components starts to be twisted and do not repaint properly.
Some of them are left half painted, showing leftovers of earlier refreshment actions happen on their pixels...
I have tried to test it and initiate (using a button) a refresh, invalidate and perform layout actions on my top UserControl, as well as on my deep one(s), but nothing helps.
I have these 'deep' user control(s) planted in other places in my GUI (less complex one I admit) and they all work properly on resize over there.
My questions:
1. Does any one have any explanation why this is going on?
2. Is there a guide line when designing a GUI in C# (or in .NET at all..) that says not to exaggerate in nesting up controls within layouts? Is there a particular overhead for this increased nesting?
3. Are there any other refresh/repaint methods that I might initiate that can fix the situation?
Thanks a'head
The Shultz.
|
|
|
|
|
Hi,
I don't have any references for this, however my advice would be:
1. keep GUI's simple; don't use dozens of Controls on a single Form, as it will have a negative impact on performance (not on correct painting though), and is likely to confuse the user; either use fewer but more appropriate Controls, or consider using more than one Form.
2. from what you described: make sure custom Paint handlers also call their base.OnPaint() .
|
|
|
|
|
Hi
1. I tend to agree, but:
A. some time GUI needs to present the user multiple options and things to define.
If the user must set these things, the GUI tends to be more 'complex' then 'simple' and you cannot run from it.
Off course there are techniques how to reduce the overhead for user (use tab control, table layout etc...) but you cannot always avoid it.
This is my case and I can't actually make it 'simpler' in the aspect of less controls and components with in
B. I personally don't like, as a user, to deal with GUI that pops up forms in which things have to be defined. I tend to like much more a fixed GUI that all screens are with in, and navigation between them is done using tab control, split container etc. that is my design here as well.
2. I am not using any custom paint, so there is no reason for the controls not to redraw them selves by the system.
Note that my User Controls are used else where in my system and they function well, so I can't believe it's a structural problem with a refresh method call that is not being called when it should...
Thanks any way
The Shultz.
|
|
|
|
|
I'm not really a Winforms bod, but do *vaguely* remember that the first thing that MS suggests with rendering problems is to ensure your Graphics drivers are up to date (naturally the problem can't be Microsoft's Rendering Mechanism ). I'd just check this before going on a wild goose chase.
Oh, I really do mean vaguely remember by the way.
|
|
|
|
|
Hi
Since my 'failed-to-repaint' User Controls are palced in other locations in my GUI, and works properly there, I can't seem to believe that this is indeed a wrong/old/bad/corrupted graphics issue, but still worth the checking...
so:
- How can I verify the 'up-to-date' of my graphics drivers ?
- Why/How could it be that they will become not 'up-to-date' ?
|
|
|
|
|
What parts of your controls are not getting repainted? Text? Parts that are in certain containers? Does selecting the control or selecting another force a repaint?
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
For example:
- I have a list view with 10 columns and horizontal and vertical scroll bar.
When the user control gets resized, not all the columns header can be seen properly and some of their text gets mixed.
The scroll bars disappear (while they shouldn't).
When I reload items to the list it gets repainted well from the beginning.
- I have some labels with in cells in table layout. When it shrinks the label automatically wraps its text with in and changes its size over the screen, when its gets spread again, some of the labels is text remain shady and gets mixed up with neighborhood labels.
It seems like the repaint operation simply does not come to its end, so the screen is left with former pixels status - pixels that should have been repainted had the operation would have completed. How can it be?
just selecting the control and gain him a focus does not couze it to be repainted. (it should have done so ?)
I m kind'a new here, is there a way that I can upload some small printscreens to farther demonstrate what I am experiance ?
|
|
|
|
|
Hi.
How can i save a word document to xml format for parsing later with xslt.
I noticed that word 2007-2010 document are constructed with the openxml format so i can use openxml tools to save it.
But word 2000-2003 seems to be in binary format.
Is there a tool that i can use for this mission?
Thanks
|
|
|
|
|
Haim Nachum wrote: Is there a tool that i can use for this mission?
Yes, Word and Save As
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Do you (a) need to access the spreadsheet data programatically, or (b) do you just need a conversion tool.
If (a), there are one or more articles on this site that will discuss the pre-XML Word format and how to read and manipulate the data.
If (b), what level of automation do you require? Indeed, File | Save as in a recent version will let you save in either OOXML or ODF formats.
|
|
|
|
|
Im sorry , i thought that if i posted the question on a c# forum and would be clear that i meant it programatically.
I will seek articals about it.
Thanks
|
|
|
|
|
Hi
don't know if this is the right place where to post.
But i was wondering if is possible to use switch statement with multiple variables, something as below :
int x = 0;
int y = 1;
switch(x,y)
{
case 1,0 :
Console.WriteLine("1,0");
break;
case 0,1 :
Console.WriteLine("0,1");
break;
case 1,1 :
Console.WriteLine("1,1");
break:
default :
Console.WriteLine("0,0");
}
thanks bye
"For as long as men massacre animals, they will kill each other. Indeed, he who sows the seed of murder and pain cannot reap joy and love." Pythagoras
|
|
|
|
|
No.
Did you check the documentation? the language specification?
You could make a composite function, in your example int z=2*x+y would suffice; but readability would suffer.
And you could make a new type, hide the values in there, spend a lot of code and waste numerous CPU cycles. What is it good for?
The obvious approach is a series of if ... else if
|
|
|
|
|
Thaks for the reply..
The obvious approach is a series of if ... else if
i agree!
You could make a composite function, in your example int z=2*x+y would suffice; but readability would suffer.<code><br />
<br />
i used int type variables just for example, actually i'm working with strings.<br />
<br />
<br />
<br />
Thanks again!! :) <br />
bye<br />
<div class="signature">"For as long as men massacre animals, they will kill each other. Indeed, he who sows the seed of murder and pain cannot reap joy and love." Pythagoras</div>
|
|
|
|
|
jadughar wrote: actually i'm working with strings
Aha. Strings probably are the only situation where I might consider it, using a concatenation, i.e. calculate x+"#"+y at run-time, and have "0#1" and the like as switch case values (C# supports string-based switches, a lot of languages don't). It might be acceptable as the cost is limited and readability does not suffer at all.
|
|
|
|
|
Good idea!!!!
Thanks Luc!!
"For as long as men massacre animals, they will kill each other. Indeed, he who sows the seed of murder and pain cannot reap joy and love." Pythagoras
|
|
|
|
|