|
Thanks but float has more digit, see reference in original post.
Also I have seen in financial apps where float is used, also NUMERIC(19,5)
What's your opinion?
dev
|
|
|
|
|
Money Data Type
---------------
- Money is compatible for currency with dollar and cent format.
- The datatype is accurate to 10 thousand times of the monetary unit.
- If the field is capable enough to store large aggregates rather than just the largest value, it is recommended to go with Money data type.
- Also with money, you have the choice to use thousand of separators.
Coming to your question directly, Do you use FLOAT or NUMERIC for financial transaction?
If it is mathematical calculations of currency or any aggregation of the same(e.g. Add,Multiply etc. which will be in fraction), or any salary field is involved, go with money datatype as opposed to the other two datatypes.
Niladri Biswas
|
|
|
|
|
yes, in some financial apps I used before (for reputable banks), numeric and float
now this app i'm doing is compat with all MySQL, M$SQL and oracle, so don't like "money".
I'm just thinking, say if I use NUMERIC(19,5), mean 5 digits after the decimal. Over say 10k transaction in say one account, USD 0.000001 x 10k = USD 0.01 = one cent USD
It's still appreciable in my opinion and I'd be more comfortable with say NUMERIC(19,7) ... but really I have seen NUMERIC(19,5) in real app.
What's your take I'm asking for an opinion.
dev
|
|
|
|
|
SQL Server considers each specific combination of precision and scale
as a different data type in case of Numeric data types.
That implies that for FLOAT(8) 99.99 and 99.999999 are same data types
though SQL SERVER interpretes NUMERIC(4,2) and NUMERIC(6,6) as different
data types (e.g. 99.99 and 99.999999 are different types )
In lieu of the above fact I would like to go with FLOAT
Niladri Biswas
|
|
|
|
|
|
Thanks very much Niladri. Sorry about the late reply.
dev
|
|
|
|
|
Hi,
I am currently using ACCESS 2003 but I am planning to develop a GUI using .NET (Visual C#). I have been told from other forums here in msdn that the best option is to use SQL Server instead of ACCESS 2003 because I am planning to use this database from many computers on the asme LAN at the same time. The DB is located on a network drive.
I saw other forums that someone say that SQL Server Express is limited to 10 users only and 4G bytes of data. Is this true?
What are the limitations? I am planning to have around 30 persons using this DB, is this possible? The data is not big, it is around 100M bytes ...
Thanks for your time
|
|
|
|
|
kikeman wrote: I saw other forums that someone say that SQL Server Express is limited to 10 users only and 4G bytes of data. Is this true?
The figures that you have given are roughly correct, in fact I think that you may be high with the users figure. (I thought that it was nearer to 4). It may also be true (it is for other M$ Express versions) that you cannot use it in production.
However, the Express version is still valid to develop against, and in most cases will port to one of the production versions with no problems.
You may find this link[^] useful
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi, I am confused now, I am not allow to use any server, I only have the option of using a network drive, currently the ACCESS DB is located there and everyone goes there to make their queries. I just want to create a better GUI using VS_C#.
My question would be now.
Is it necesary to have a server in order to use SQL Server Express?
Could it work only as a collection of data on a network-drive, so that, the DB operations would be performed on the C# application? Transactions?
|
|
|
|
|
I develop against SqlExpress 2005 and 2008, both of which run on my dev box. My data however is in all sorts of places, including network drives.
So in my scenario, each computer that will access the data needs the appropriate version of SqlExpress running on it and what you then have to do is ensure that the connectionstrings used in your applications are written in such a way as to guarantee to locate the correct database, regardless of which machine is being used.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
So what you are saying is that SQL Server Express does not need a centralized computer (server) to run.
Can I develop a distributed database?
So that, actually the DB is all over on the networked computers?
|
|
|
|
|
kikeman wrote: Can I develop a distributed database?
So that, actually the DB is all over on the networked computers?
I am sorry to say that the answer to that is beyond my knowledge. I think probably not, but cannot be sure.
If I were you I would post that as a new thread, something like "Can I do a Distributed Database with SQLExpress", or something like that.
Sorry not to be able to help.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi,
Advantages of SQL SERVER EXPRESS EDITION
http://msdn.microsoft.com/en-us/library/ms345154(SQL.90).aspx[^]
Q1)Limitations of SQL SERVER EXPRESS EDITION
<a href="http://www.dotnetspider.com/SqlServer-Tutorial-158.aspx">http:
Q2) I am planning to have around 30 persons using this DB, is this possible?
There is no hard-coded limit to the number of users that can attach to SQL Server Express but their CPU and memory limits impose practical limits on the number of users that can achieve acceptable response times from a SQL Server Express database.
(Obtained from SQL Server 2005 Express Edition Overview)
You may also be interested in SQL Server 2005 Features Comparison
http://www.microsoft.com/Sqlserver/2005/en/us/compare-features.aspx[^]
Hope it helps
Niladri Biswas
|
|
|
|
|
I have a database (mssql 2005) with a table which has a datetime column. I'm trying to insert data into tha table from c# but i'm getting this exception: "Conversion failed when converting datetime from character string". Here is the code (stripped of connection declaration).
SqlParameter currentDate = new SqlParameter();
currentDate.Value = System.DateTime.Now;
currentDate.ParameterName = "@dataTrimitereService";
string insert = "INSERT INTO table(col 1, col 2, date) VALUES ('value 1', 'value 2', '@dataTrimitereService');
sqlCommand.ExecuteNonQuert(insert);
I've also tried changing regional settings and date format but no success. Thanks.
|
|
|
|
|
What is value in @dataTrimitereService?
Niladri Biswas
modified on Sunday, June 28, 2009 3:59 AM
|
|
|
|
|
it's System.DateTime.Now which returns 28.06.2009 10:30:30 (example).
|
|
|
|
|
Hi, I have created a similar kind of thing like yours.
A table with 3 fileds (COL1,COL2,Date) as
(VARCHAR(50),VARCHAR(50),DATETIME respectively)
In C# class, I have written this statement
public class DBConnectionSQL
{
string connectionPath = "Data Source=Niladri135\\SQLEXPRESS;Initial Catalog=test;Integrated Security=True";
string command = "";
public void InsertRecords()
{
SqlConnection connection = new SqlConnection(@connectionPath);
DateTime currentValue = System.DateTime.Now;
command = "Insert Into test_Datetime (COL1, COL2,DATE) values('value 1', 'value 2'," + "'" + currentValue + "'" + ")";
try
{
connection.Open();
SqlCommand cmd = new SqlCommand(command, connection);
cmd.ExecuteNonQuery();
}
catch (SqlException sqlExcep)
{
string msg = sqlExcep.Message;
}
finally
{
connection.Close();
}
}
}
And I got the correct result.
N.B.~ Check the value in the insert string in your case. Is the datetime value within single quote e.g.'6/28/2009 1:20:55 PM' ?
Hope this helps
Niladri Biswas
|
|
|
|
|
Passing the date to the select statement directly (not parameter) raises this exception: "The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.\r\nThe statement has been terminated."
|
|
|
|
|
I've ran the query directly in sql and tried different date formats. It finnaly accepted "mm/dd/yyyy hh:mm:ss". How can I make c# convert into the right format without changing regional settings. My current date format (from regional settings) is dd.mm.yyyy
|
|
|
|
|
Hi,
Last day there was some problem in the afternoon in posting the message. So I was unable to reply you though I tried many times. However, I emailed you the solution.
Try with the solution which I gave . That's a running application.
N.B.~ The default DateTime format in my system is "mm/dd/yyyy hh:mm:ss"
By the way if you need to convert the date format e.g. dd.mm.yyyy to
mm/dd/yyyy hh:mm:ss, use the
DateTime.ParseExact() Method .
e.g. I want to convert from 28.06.2009 i.e. dd.mm.yyyy to
mm/dd/yyyy hh:mm:ss
string OldDateFromat = "28.06.2009";
DateTime dt = DateTime.ParseExact(OldDateFromat, "dd'.'MM'.'yyyy",
CultureInfo.InvariantCulture);
Hope this helps you.
Let me know in case of any concern
Niladri Biswas
modified on Sunday, June 28, 2009 11:25 PM
|
|
|
|
|
Niladri_Biswas wrote: The default date format in c sharps Datetime.Now is "mm/dd/yyyy hh:mm:ss".
I disagree: the default DateTime format is the one specified in your Regional Settings Control Panel, it is up to the user to choose the format he likes to use.
FYI: For data interchange, there is an IEC 8601 standard, as explained here[^].
FWIW: where ever possible, a real date or datetime field is better than a string.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
Correct . I am sorry for my mistake . I edited that line.
Niladri Biswas
|
|
|
|
|
Thanks for your help. I've done it with DateTime.Parse() already.
|
|
|
|
|
I have been trying to solve this for quite sometime, I have google it as well. My connection string is as follows: "Data Source=xxx.xxx.8.20,1433;Network Library=DBMSSOCN;Initial Catalog=myDatabase;Trusted_Connection=Yes;"
Though my remote server is SQL 2000 Server. On my developer platform I have SQL 2005 and 2000, but whenever I debug the application, it is giving the error:
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: TCP Provider, error: 0 - No connection could be made because the target machine actively refused it.)
I can ping the remote server. I can also connect to the server from the studio, please what can I do to solve this problem.
Thank you in advance.
Thayhor
|
|
|
|
|
Enable the TCP/IP port.
It should have been done at the time of installation of SQL SERVER only.
However, follow these steps
1) Start Menu - > Microsoft Sql Server 2005 -> Configuration tools -> Sql Server Configuration Manager
2)Once in that window, expand the SQL Native Client Configuration node which you will find on your left side.
3) From there, choose the Client Protocols. All the client protocols, that are available in your system will be listed in the right pane.
4) Enable the TCP/IP port.
5) Re-Start the SQL SERVER Agent from the services.
Hope this helps.
Niladri Biswas
|
|
|
|