|
-
September 2nd, 2010, 05:48 PM
#1
Trouble with dates after reinstalling MSSQL
I have one project running on a DB on MSSQL 2k, with other *big* 3rd party software.
2 days ago they have a problem with MSSQL, and for some reason instead of looking for the problem they installed MSSQL on top the previous version, restore the backups of the 2 DBs and start using it again.
The other software works ok, my project has problems with dates
Example code:
Code:
Dim fechaInicio As New SqlClient.SqlParameter("@FechaInicio", SqlDbType.DateTime)
Dim fecha1 as string
fechaInicio.Value = Format(DTPInicio.Value, "yyyy/MM/dd")
fecha1 = Format(DTPInicio.Value, "dd/MM/yyyy")
sql = "Select Sini from saldos where fecha='" & fechaInicio.Value & "' and IDsucursal=" & IDSucursal.Value
InicialBanco = db.GetScalar(sql)
All queries I made using the data of the backup (with date <=30/08/2010) trow "The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value."
And I can do queries of data newer than the backup.
I checked visually the data of the DB, and all seems to be ok.
To do the queries for dates <=30/08/2010 I need to use in the SQLStatement "fecha1" instead of "fechaInicio.Value".
For data inserted after 1/09/2010 I still have some dates problem, I think that if I solve the previous problem the others will be solved too.
The code posted was worked perfectly for months.
I know I can improve the way I make the queries, but for now I need something to make this project run again while I continue improving it.
Thanks a LOT
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|