|
ahhh ... seems I'm being daft ... I was missing
using System.Windows
schoolboy error ...
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
Hi, as simple as it sounds i'm having difficulties to achieve this.
I have tried several ways but none of them works. This a part of my
code:
decimal amount = reader.GetSqlMoney(4).ToDecimal();
subtotal += amount ;
What happens is that the value returned every time from my
first line of code is zero.
Also when i tried for testing purposes to give that value
to a control's text property it works fine.
Thanks
|
|
|
|
|
I would do it like this:
decimal amount = (decimal)rdr["MoneyColumnName"]; Just cast to decimal and forget about money in the C# side of things. That's the way I have always done it and I have had no issues.
After all, in SQL Server money is actually a decimal with a specific precision.
|
|
|
|
|
i'm still getting zero as a result. do you think anything
else could be wrong that i should double-check?
|
|
|
|
|
Well, the obvious things. Is your query returning the value of a money column? If you execute your query in SQL Management Studio, do you get the correct value?
Could you show more code (creating the command, the parameters, the query or stored procedure, and so on)?
|
|
|
|
|
Do you close your Database Connection prior reading the DataReader?
Did you check the HasRows property for your DataReader?
Did you check while (reader.Read()) before casting the values?
example:
conn.Open();
SqlDataReader reader = command.ExecuteReader();
if (reader.HasRows)
{
while (reader.Read())
{
// your castings here
}
}
reader.Close();
conn.Close();
|
|
|
|
|
Hi All,
I'm just doing some work in DirectX and have a referencing question. Using this method on a device needs a handle to the main apps window the problem with that was my directX layer was referenced by the presentation layer so to actually set this to my apps mainwindow class i've had to reference the presentation layer from the audiolayer ...
Does it actually make sense to reference this way around or is there a better solution to this issue?
This is a WPF window and unlike WinFOrms (as far as I can tell) this isn't showing me a Handle property to specify, any advice on that would be great.
Cheers,
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
Have been doing a bit more digging at it seems that my fix is the way to go. Since WPF windows are essentially DirectX setting the SetCooperativeLevel to System.IntPtr.Zero is the way to go ...
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
"select name from table_a where birthday= "+ a.toshortdatestring();
hey guys,
when executing the code above i get a message like "data types are not the same". i think the reason is that access doesn't accept "12.10.2007" as a date. in db birthday is a column and its data type is date(shortdate).
I am trying to do it in c#(i mean executing the query above) and the result of the query will be kept in datagridview object.
how can i solve the problem ? any help is appreciated.
thanks
|
|
|
|
|
Use paremeterized queries. You'll avoid this kind of problems, but also you'll avoid a big security risk (SQL injection, see here[^])
DateTime birthday = new DateTime(1981, 8, 16);
string sql = "select name from table_a where birthday = ?";
OleDbCommand cmd = new OleDbCommand(sql, conn);
cmd.Parameters.AddWithValue("p1", birthday);
I hope this helps!
|
|
|
|
|
|
Hello,
i would share my application on the network(it use sqlserver2005 with oleDb), in the server, it works normally, and when I put a shortcut and I share there are an exception:
Failed to request permission of type 'Dat oleDb.OleDbërmission System, System.Data, Version = 2.0.0.0, Culture = neutral, PublicKeyToken = b77a5c561934e089'.
Please help me to share my application.
Thank you very much
|
|
|
|
|
Let's see if I understood correctly: You have your .EXE which works correctly on the computer it is, but if you run it from the network (eg. \\computer\share\myexe.exe ) you get that exception?
.NET has some security restrictions in which an executable run from the network doesn't get full trust permissions. What you need to do is:
1. Copy the .EXE to each client machine so it's run locally
2. Share the database on the server. OleDB can access databases on a network location
Google for ClickOnce, it might be of help to you.
|
|
|
|
|
how i can Share the database on the server. OleDB can access databases on a network location??
with Sqlserver2005 i add a connexion with name of user and password, but my application cant acces to database on server, pleas help me, thank you verry mutch
|
|
|
|
|
Sorry, I misread. I thought you were using Access because I read OleDb and answered another question about Access. My fault here.
Forget about that databse sharing stuff. SQL Server can be accessed the same way from the server or from any network computer (just be sure to use the real server name and not (local) in your connection string, and to enable TCP/IP for SQL Server, which by default comes disabled). The same connection string will work from everywhere.
For the permission thing, you need to copy your .EXE to each computer, instead of running it directly from the network location.
|
|
|
|
|
i'm wondering if anyone out there knows how to "enable" a form to dock inside of another form (like the tool box, solution explorer, etc. in vs.net) in c#.
source code would be most helpful and i don't want to have to instal anything to do this.
|
|
|
|
|
Try Google for docking controls?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
Hai codies..Greetings of the day
My Requirement is as follows..
I need to put multiple dockable windows in the same location.i.e. one window down the other ..without using the Third party tool..
I need to develop using c# ...Can any one help me out... I need sample code (if possible)...
Once again Precisely my requirement..
if i double click on the panel .It should be moved to left side of the parent window.
If i double click on another panel , am able to display only by the side of the previous docked panel.
Bur it should be moved to the same location of the previous window i.e it should be displayed down the previous window(column).
Please Help me out ...
thanks in advance .. Early response will be appreciated..As the target time for the completion is very Near....
Thanks again.
regards.
Subhashshastry@gmail.com
|
|
|
|
|
Did you try searching the site before asking? If you had, you would have found this article[^] that seems to do exactly what you want.
|
|
|
|
|
Hi Luis,
Thanks for the Patience in reading the requirement ..
It seems that my requirement is almost done.. I will let you know once it gets completed..
Thanks once again..
regards,
SUBBU
|
|
|
|
|
Hello,
I am using ReportViewer to print report. I am using object as data source.
I am having an array of string (string[]) and i want to display it in my header section of report.
Which control should i choose from ReportViewer toolBox to display the sting array list and how can i fill the control with my data?
Thanks
Gajesh
|
|
|
|
|
gajesh wrote: I am having an array of string (string[]) and i want to display it in my header section of report.
You can't. All elements of report content are contained in the report definition itself.
I'm not sure how you could do this. Data for reports usually comes from a database. Maybe you could write a custom component to allow data binding to an array.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Thanks Paul,
In ReportItems toolbox List control is available.
I am not sure about how to use it?
How can i supply my list of data to this List(ReportRendering.List) to display them?
OR i need to create separate oject for each collection of data?
Regards
Gajesh
|
|
|
|
|
Different softwares have different icons for their executables. Like Windows Media Player, Zoom Player, Winamp, Comodo Firewall. I also want to give my project exes a unique icon. So what is the best size of the image/icon to be used for this purpose.
I think it is 128x128.
What do you say?
Thanks
Sukhjinder
Looking for help on my OpenSource Media Player LetsYo
|
|
|
|
|
Actually I would have several sizes. You can only have one icon file (.ico) but that file can have images of different sizes. At least I would have:
16x16 - for Explorer list or Start Menu)
32x32 - regular icon
48x48 - big Vista icons (default size for desktop)
64x64 is used also sometimes in Vista, but I am not sure it is as common.
|
|
|
|