|
yeah I just came up with that IDbConnection inteface
or shall I just make an abstract class and then make a class for each DB Client?
|---------------|
| theJazzyBrain |
|---------------|
|
|
|
|
|
Only two question:
Is it realy needed to support Sql and OleDb clients at the same time?
You need both dataaccess methods in runtime?
I make my current project using only OleDb... And I can say that i have no performance looses. OleDb give you more kinds of storages that can be used by you.
So... if you still interesting in support of two data access methods then better write own short wrappers... later they can be easily grow to someting more complex.
Good Luck
Alex Kucherenko
|
|
|
|
|
I see your point,
but, as Microsoft claim, the SqlClient is suppose to be much faster than OleDb when using SQLServer. So I feel that it is important to use it...
Depends always on the application and what performance you are looking for I guess...
But once I getting into the mission to make an object to handle all DB interaction, (and I have the time to do it now) I rather do it now than having to come back in a few months and sort out then...;)
I think that I will make an abstract class and then have a class for each client... This way it is more expandable aswell...
I might share it in an article when I am done.;P ;P
Thank you all anyway for your help!!!...
I am sure that I will be back with more qestions soon...
|---------------|
| theJazzyBrain |
|---------------|
|
|
|
|
|
Nope.
Go for the interface...
|
|
|
|
|
I dont know how to use it
I will read MSDN...
|---------------|
| theJazzyBrain |
|---------------|
|
|
|
|
|
Like this:
<br />
private IDbConnection objConnection;<br />
objConnection will now take either a SqlConnection or a OleDbConnection object.
(objConnection = new SqlConnection(); or objConnection = new OleDbConnection(); will work equally well...)
The IDbConnection interface has the Open() and Close() methods, so you don't have to do casts to use them...
objConnection.Open();
|
|
|
|
|
this is looking good...
than you
|---------------|
| theJazzyBrain |
|---------------|
|
|
|
|
|
Hi,
I'm looking for a mean to use printer fonts in c# or vb.net
I've tried with drawing.text.installedFontCollection, but i doesn't find the printer fonts only system fonts
In VB6 there is a very simple function : Printer.Fonts()
How can i do this in .NET
can somebody help me?
thx
|
|
|
|
|
Are you sure printer fonts are not the same as system fonts in .Net?
Mazy
No sig. available now.
|
|
|
|
|
i don't know but i've not access to them.
When i am looking after the font name in wordpad for exemple: "ZB:Code 128" and use it in .NET i doesn't work, .net creates a default font.
|
|
|
|
|
Hi.
I created winform application.
And There is a empty tabcontrol. When i click menuitem to add tabpage,
i create tabpage and add tabpage to tabcontrol.
It is simple.^^
But, What i want to do is to hadle tabpage focus.
When i press mouse right button on a tabpage,the tabpage must have focus and
show the context menu. when i clicked context menu to close tabpage,that tabpage must be closed.
I don't know how to get the tabpage reference,when i press a right mouse button. Would you tell me the way to solve this problem?
As soon as possibe,i hope you write sample codes.
Help me,please.
|
|
|
|
|
I know how to bind a web treeview to an XML data source, but not how to bind a Windows Forms treeview to an XML data source. Is this even possible? (BTW, I'm not talking about binding just any property - I'm talking about binding the nodes.)
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
How would I change this darn VB.net code to C#?
Public Function AddPortalInfo(ByVal PortalName As String,
ByVal PortalAlias As String, Optional ByVal Currency As String = "",
Optional ByVal FirstName As String = "", Optional ByVal LastName As String = "",
Optional ByVal Username As String = "", Optional ByVal Password As String = "",
Optional ByVal Email As String = "", Optional ByVal ExpiryDate As String = "",
Optional ByVal HostFee As Double = 0, Optional ByVal HostSpace As Double = 0,
Optional ByVal SiteLogHistory As Integer = -1, <SqlParameter(, , , , , ParameterDirection.Output)>
Optional ByVal PortalId As Integer = -1) As Integer
Dim myConnection As New SqlConnection(GetDBConnectionString)
' Generate Command Object based on Method
Dim myCommand As SqlCommand = SqlCommandGenerator.GenerateCommand(myConnection, _
CType(MethodBase.GetCurrentMethod(), MethodInfo), _
New Object() {PortalName, PortalAlias, IIf(Currency <> "", Currency, "USD"),
FirstName, LastName, Username, Password, Email, IIf(ExpiryDate <> "", ExpiryDate, SqlInt16.Null),
HostFee, HostSpace, IIf(SiteLogHistory <> -1, SiteLogHistory, SqlInt16.Null), PortalId})
myConnection.Open()
myCommand.ExecuteNonQuery()
myConnection.Close()
Return CInt(myCommand.Parameters("@PortalID").Value)
End Function
I never got into vb.net so I have no idea what to do with the Optional keyword. Does that mean I have to makie a bunch of overloads of this functionin C#?
<SqlParameter(, , , , , ParameterDirection.Output)> wtf is that?
How do I get around the IIf thing (does that mean if and only if ?
Thanks for any clarification on this garbage;)
Steve
McLenithan
Is Bert Evil? | Homer: "Hello, operator, gimme the number for 911!"
|
|
|
|
|
1. There is no equivalent for optional in C# you it looks like you might have to overload your function
2.sqlparameter is an attribute. C# defines it's attributes with '[' instead '<'
3. use the "?::" notation in C#, as in
expression<code>?</code>what to do if true<code>:</code>what to do when false;
Nick Seng (the programmer formerly known as Notorious SMC)
God, I pity me! - Phoncible P. Bone
|
|
|
|
|
Thanks
Steve
McLenithan
Is Bert Evil? | Homer: "Hello, operator, gimme the number for 911!"
|
|
|
|
|
Steve McLenithan wrote:
Does that mean I have to makie a bunch of overloads of this functionin C#?
Yes.
You could:
*Do lots of overloads that delegate to a single function.
*Do lots of overloads that each do the job slightly differently.
*Force people to pass null to all the values they don't use, and check for null as necessary.
Steve McLenithan wrote:
<sqlparameter(, ,="" parameterdirection.output)=""> wtf is that?
That's how VB.NET does attributes, but I thought SqlParameter was a regular class, not an attribute.
Steve McLenithan wrote:
How do I get around the IIf thing (does that mean if and only if?
In C#, this:
IIf(ExpiryDate <> "", ExpiryDate, SqlInt16.Null)
becomes this:
(ExpiryDate != "" ? ExpiryDate : SqlInt16.Null)
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
|
|
Nothing... It's the challenge. It's the whole point of my project;)
Steve
McLenithan
Is Bert Evil? | Homer: "Hello, operator, gimme the number for 911!"
|
|
|
|
|
|
Nice very nice. What a HUGE time saver. Thanks.
Steve
McLenithan
Is Bert Evil? | Homer: "Hello, operator, gimme the number for 911!"
|
|
|
|
|
As I was practicing my C# skills I came across the code below:
int myFunc()
{
int x;
x = 42;
x++;
x += --x;
return x;
}
What is the value returned from myFunc() ?
As a C++ programmer I thought: "84 of course".
But when I compiled with C#, the function returns 85 .
Just to confirm, I also compiled the same code with Java and returned 85 too.
Well... Can anyone explain this? :P
modified 25-May-20 21:50pm.
|
|
|
|
|
I don't see how C++ would return 84??
int x; x = 0
x = 42; x = 42
x++; x = 43
x += --x; == x = x + (--x) == x = 43 + 42 x = 85
Is there something I'm missing??
Admittedly, I haven't done C++ in a while
Nick Seng (the programmer formerly known as Notorious SMC)
God, I pity me! - Phoncible P. Bone
|
|
|
|
|
|
hmmm..... Shouldn't it be left to right(order of operation) ?
I mean:
x = x + (--x) : At the beginning of this line x is still 43
x = x + (--x) : which would imply that this x is still 43
thus, you would get 85?
[Edit]Something just occured to me, does, --x imply that the incrementer execute before any other operators? [/Edit]
Nick Seng (the programmer formerly known as Notorious SMC)
God, I pity me! - Phoncible P. Bone
|
|
|
|