SqlDatetime-Overflow On Production Server

Jun 4, 2008

Hey everybody!

I'm getting a pretty annoying error on my production server when i want to run an app ..

Error Msg (german): SqlDateTime-Überlauf; muss zwischen 1/1/1753 12:00:00 AM und 12/31/9999 11:59:59 PM liegen.

Funny thing is that on my client development machine i'm not getting an error at all. The DateTimes I use (C# and SQL Server) are dd/mm/yyyy hh:mm:ss formatted. I also don't write to the databse - only read!

Anyone familiar with this issue?

Thanks in advance & best regards!

View 2 Replies


ADVERTISEMENT

SqlDateTime Overflow

Aug 6, 2007

I've seen a few comments on this error and they've all been basically "You're passing a bad date time". I don't think that's what's happening in my case though.
I'm trying to write a record to my SQL database using a business logic layer class that writes the record with a stored procedure. Here's the codebehind on the page: Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs)
'Create New User
UsersBLL.NewUser(txtFirstName.Text, _
txtLastName.Text, _
txtPhone1.Text, _
ddlOffice.SelectedIndex, _
lblManager.Text, _
lblManagerAlt.Text, _
txtDepartment.Text, _
cbxNewPosition.Checked, _
cbxContractor.Checked, _
Calendar1.SelectedDate.ToString, _
txtJobTitle.Text, _
ddlFunctionCodes.SelectedIndex)

End Sub 
Here's the BLL function that I'm calling:
    Public Shared Function NewUser(ByVal UsersNameFirst As String, _                    ByVal UsersNameLast As String, _                    ByVal UsersPhone1 As String, _                    ByVal OfficesID As Int32, _                    ByVal UsersID_Manager As Int32, _                    ByVal UsersID_ManagerAlt As Int32, _                    ByVal UsersDepartment As String, _                    ByVal UsersNewPosition As Boolean, _                    ByVal UsersContractor As Boolean, _                    ByVal UsersStartDate As DateTime, _                    ByVal UsersJobTitle As String, _                    ByVal FunctionCodesID As Int32, _                    Optional ByVal UsersGSN As String = Nothing, _                    Optional ByVal UsersEmail As String = Nothing, _                    Optional ByVal UsersNameMiddle As String = Nothing, _                    Optional ByVal UsersKnownAs As String = Nothing, _                    Optional ByVal UsersPhone2 As String = Nothing, _                    Optional ByVal UsersPhoneMobile1 As String = Nothing, _                    Optional ByVal UsersPhoneMobile2 As String = Nothing, _                    Optional ByVal UsersSSN As String = Nothing, _                    Optional ByVal UsersContractType As String = Nothing, _                    Optional ByVal UsersContractAgency As String = Nothing, _                    Optional ByVal UsersEndDate As DateTime = Nothing, _                    Optional ByVal UsersCompanyCode As String = Nothing, _                    Optional ByVal UsersCostCenter As String = Nothing, _                    Optional ByVal UsersRole As String = Nothing, _                    Optional ByVal StatusesID As Int32 = Nothing)        Dim dbConnection As SqlConnection, Command As SqlCommand        dbConnection = New SqlConnection(DBConnectionString)        dbConnection.Open()        Command = New SqlCommand("EXECUTE NewUser", dbConnection)        Command.Connection = dbConnection        Command.CommandText = "NewUser"        Command.CommandType = Data.CommandType.StoredProcedure        Command.Parameters.Add(New SqlParameter("@UsersNameFirst", UsersNameFirst))        Command.Parameters.Add(New SqlParameter("@UsersNameLast", UsersNameLast))        Command.Parameters.Add(New SqlParameter("@UsersPhone1", UsersPhone1))        Command.Parameters.Add(New SqlParameter("@OfficesID", OfficesID))        Command.Parameters.Add(New SqlParameter("@UsersID_Manager", UsersID_Manager))        Command.Parameters.Add(New SqlParameter("@UsersID_ManagerAlt", UsersID_ManagerAlt))        Command.Parameters.Add(New SqlParameter("@UsersNewPosition", UsersNewPosition))        Command.Parameters.Add(New SqlParameter("@UsersContractor", UsersContractor))        Command.Parameters.Add(New SqlParameter("@UsersStartDate", UsersStartDate))        Command.Parameters.Add(New SqlParameter("@UsersJobTitle", UsersJobTitle))        Command.Parameters.Add(New SqlParameter("@FunctionCodesID", FunctionCodesID))        Command.Parameters.Add(New SqlParameter("@UsersGSN", UsersGSN))        Command.Parameters.Add(New SqlParameter("@UsersEmail", UsersEmail))        Command.Parameters.Add(New SqlParameter("@UsersNameMiddle", UsersNameMiddle))        Command.Parameters.Add(New SqlParameter("@UsersKnownAs", UsersKnownAs))        Command.Parameters.Add(New SqlParameter("@UsersPhone2", UsersPhone2))        Command.Parameters.Add(New SqlParameter("@UsersPhoneMobile1", UsersPhoneMobile1))        Command.Parameters.Add(New SqlParameter("@UsersPhoneMobile2", UsersPhoneMobile2))        Command.Parameters.Add(New SqlParameter("@UsersSSN", UsersSSN))        Command.Parameters.Add(New SqlParameter("@UsersContractType", UsersContractType))        Command.Parameters.Add(New SqlParameter("@UsersContractAgency", UsersContractAgency))        Command.Parameters.Add(New SqlParameter("@UsersEndDate", UsersEndDate))        Command.Parameters.Add(New SqlParameter("@UsersCompanyCode", UsersCompanyCode))        Command.Parameters.Add(New SqlParameter("@UsersCostCenter", UsersCostCenter))        Command.Parameters.Add(New SqlParameter("@UsersCostCenter", UsersCostCenter))        Command.Parameters.Add(New SqlParameter("@UsersRole", UsersRole))        Command.Parameters.Add(New SqlParameter("@StatusesID", StatusesID))        Return Command.ExecuteScalar()        dbConnection.Close()  
 
Here's the stored procedure I'm running in SQL:
  (
@UsersGSNvarchar(20) = Nothing,
@UsersNameFirstvarchar(20),
@UsersNameMiddlevarchar(20) = Nothing,
@UsersNameLastvarchar(20),
@UsersKnownAsvarchar(20) = Nothing,
@UsersPhone1varchar(50),
@UsersPhone2varchar(50) = Nothing,
@UsersPhoneMobile1varchar(20) = Nothing,
@UsersPhoneMobile2varchar(20) = Nothing,
@UsersEmailvarchar(50) = Nothing,
@OfficesIDint,
@UsersDepartmentvarchar(50),
@UsersSSNvarchar(5) = Nothing,
@UsersNewPositionbit,
@UsersContractorbit,
@UsersContractTypevarchar(20) = Nothing,
@UsersContractAgencyvarchar(50) = Nothing,
@UsersStartDatedatetime,
@UsersEndDatedatetime = Nothing,
@UsersJobTitlevarchar(50),
@FunctionCodesIDint,
@UsersCompanyCodevarchar(20) = Nothing,
@UsersCostCentervarchar(20) = Nothing,
@UsersID_Managerint,
@UsersID_ManagerAltint,
@UsersRolevarchar(20) = "User",
@StatusesIDint = 1
)
AS
SET NOCOUNT OFF;

INSERT INTO [Users]
(UsersGSN,
UsersNameFirst,
UsersNameMiddle,
UsersNameLast,
UsersKnownAs,
UsersPhone1,
UsersPhone2,
UsersPhoneMobile1,
UsersPhoneMobile2,
UsersEmail,
OfficesID,
UsersDepartment,
UsersSSN,
UsersNewPosition,
UsersContractor,
UsersContractType,
UsersContractAgency,
UsersStartDate,
UsersEndDate,
UsersJobTitle,
FunctionCodesID,
UsersCompanyCode,
UsersCostCenter,
UsersID_Manager,
UsersID_ManagerAlt,
UsersRole,
StatusesID)

VALUES
(@UsersGSN,
@UsersNameFirst,
@UsersNameMiddle,
@UsersNameLast,
@UsersKnownAs,
@UsersPhone1,
@UsersPhone2,
@UsersPhoneMobile1,
@UsersPhoneMobile2,
@UsersEmail,
@OfficesID,
@UsersDepartment,
@UsersSSN,
@UsersNewPosition,
@UsersContractor,
@UsersContractType,
@UsersContractAgency,
@UsersStartDate,
@UsersEndDate,
@UsersJobTitle,
@FunctionCodesID,
@UsersCompanyCode,
@UsersCostCenter,
@UsersID_Manager,
@UsersID_ManagerAlt,
@UsersRole,
@StatusesID);  
 
Seems about as simple as it can get to me. UsersStartDate is a datetime (which I'm picking from a calendar control on the web page) and it's passing (for example) "08/01/2007 12:00:00 AM". I've debugged and that's the value being passed.
 Now when I go to my DB and write a simple insert query and insert exactly that date, it works fine. Maybe my development machine date settings are changing it somehow before it sends to the DB?
Also I'm pretty sure there's a lot of redundant passing of all those vars but I'm brand new to tiered apps and just learning. If there's a simpler way, feel free to enlighten me. :)

View 8 Replies View Related

SqlDateTime Overflow

Mar 13, 2006

Hi All,
Please help!!! I've looked all over the place and tried all the solutions that worked for others. I just want to insert a Null value to a DateTime field in my SQL db! I am calling dv_ItemInserting on ItemInserting of my FormView.
I tried using a stored procedure to fix this problem SET @opDate = NullIf(@opDate, NULL). I am still getting the same error.
Please forward any info you have. Thanks!!!
----------------------------------------------
Error:
SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.
Protected Sub dv_ItemInserting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.FormViewInsertEventArgs)
 If e.Values.Item("opDate").Equals(Nothing) OrElse e.Values.Item("opDate").Equals(DateTime.MinValue) Then'Tried the followings and they do not work !!!     
      'SqlDataSource1.InsertParameters("opDate").DefaultValue = System.DBNull.Value      'e.Values.Item("opDate") = System.Data.SqlTypes.SqlDateTime.Null.Value
 end if End sub

View 3 Replies View Related

Error: SqlDateTime Overflow !!!???

Jul 24, 2004

When I run my query

dr = Me.SqlComm_Chk_ATLGroup.ExecuteReader

it give me this error:

SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.


This is my Query :

SELECT break_time, break_rep_no, break_type, break_user_id
FROM breaks
WHERE (break_date = @p1) AND (break_group = @p2) AND (break_time > @p3) AND (break_time < @P4)
ORDER BY break_time

This is the code

Dim dr As SqlClient.SqlDataReader

Me.SqlConn.Open()
Me.SqlComm_Chk_ATLGroup.Parameters(0).Value = #7/23/2004#
Me.SqlComm_Chk_ATLGroup.Parameters(1).Value = 0
Me.SqlComm_Chk_ATLGroup.Parameters(2).Value = #10:00:00 AM#
Me.SqlComm_Chk_ATLGroup.Parameters(3).Value = #2:00:00 PM#

dr = Me.SqlComm_Chk_ATLGroup.ExecuteReader

While dr.Read

End While

Me.SqlConn.Close()

Note : when I store the time in a string and display it it gives me 10:00:00 AM 1/1/0001 or something like that ?

Where is the problem?

View 3 Replies View Related

PLEASE HELP ME: SqlDateTime Overflow. Must Be Between 1/1/1753 12:00:00 AM And 12/31/9999 11:59:59 PM.

Feb 21, 2007

I cannot for the life of me figure out why im still getting this
error. I have tried everything i can think of from using dbnull.value
to setDOBnull() to datetime.minvalue. Can anyone help me? Here's the code on my BLL:   
Public Function AddEmployee(ByVal SSN As String, ByVal FirstName As
String, ByVal LastName As String, ByVal PreferredName As String, ByVal
MaidenName As String, ByVal MaritalStatus As Nullable(Of Char), ByVal
DOB As Nullable(Of Date), ByVal Gender As Nullable(Of Char), ByVal
Ethnicity As String, ByVal StartDate As Nullable(Of Date), ByVal
TerminationDate As Nullable(Of Date)) As Boolean        ' Create a new employeeRow instance        Dim employees As New HRMS.EmployeesDataTable()        Dim employee As HRMS.EmployeesRow = employees.NewEmployeesRow()        Dim sqldatenull As SqlDateTime        sqldatenull = SqlDateTime.MinValue.Value        employee.SSN = SSN        employee.FirstName = FirstName        employee.LastName = LastName        If PreferredName Is Nothing Then employee.SetPreferredNameNull() Else employee.PreferredName = PreferredName        If MaidenName Is Nothing Then employee.SetMaidenNameNull() Else employee.MaidenName = MaidenName        If Not MaritalStatus.HasValue Then employee.SetMaritalStatusNull() Else employee.MaritalStatus = MaritalStatus.Value        If Not DOB.HasValue Then employee.SetDOBNull() Else employee.DOB = DOB.Value        If Not Gender.HasValue Then employee.SetGenderNull() Else employee.Gender = Gender.Value        If Ethnicity Is Nothing Then employee.SetEthnicityNull() Else employee.Ethnicity = Ethnicity       
If StartDate = DateTime.MinValue Then employee.StartDate =
SqlDateTime.MinValue.Value Else employee.StartDate = StartDate.Value        'If StartDate = DateTime.MinValue Then employee.SetDOBNull() Else employee.StartDate = StartDate.Value        'If Not StartDate.HasValue Then employee.StartDate = sqldatenull Else employee.StartDate = StartDate.Value       
If TerminationDate = DateTime.MinValue Then employee.TerminationDate =
SqlDateTime.MinValue.Value Else employee.TerminationDate =
TerminationDate.Value P

View 8 Replies View Related

SqlDateTime Overflow. Must Be Between 1/1/1753 12:00:00 AM And 12/31/9999 11:59:59 PM

Jul 16, 2007

Hi there...
 i have a search page with consitst of DatePicker and DataView
this is how i'm binding my dataview
<asp:ObjectDataSource runat="server" EnableCaching="false" ID="ods" TypeName="daab.Employee"                                                        SelectMethod="GetEmployee">                                                        <SelectParameters>                                                                                                                         <asp:ControlParameter ControlID="DatePicker1" ConvertEmptyStringToNull="true" PropertyName="SelectedDate" Name="SearchDate" Direction="Input" Type="DateTime" />                                                        </SelectParameters>                                                    </asp:ObjectDataSource>
..........................................................................................
the searchDate is optional user may select date from datepicker or leave it blank if (!string.IsNullOrEmpty(DatePicker1.SelectedDate))
{ //
}
else
{
this.ods.SelectParameters["SearchDate"].DefaultValue = DBNull.Value.ToString();
}
 when i execute the above code i get this error:, what i'm missing?
error Message = "SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM."

View 10 Replies View Related

SqlDateTime Overflow. Must Be Between 1/1/1753 12:00:00 AM And 12/31/9999 11:59:59 PM.

Apr 10, 2008

hey,
i will make calender(by use Asp.net 2003 - C# - framework 2.0 ) that stored and retreive data from Database(SQL Server 2000), that success , but if add this function (Calendar1_DayRender)

Server Error in '/bwarq' Application.


SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlTypes.SqlTypeException: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.Source Error:




Line 1999:DA.SelectCommand.Parameters.Add("@eventdate",eventdate);
Line 2000:DataTable DT=new DataTable();
Line 2001:DA.Fill(DT);
Line 2002:DA.SelectCommand.Connection.Close();return DT;
Line 2003:}
Source File: c:inetpubwwwroot4paldataaccess.cs    Line: 2001 
 
and i want to see my files here:
 
1- DataAccess(put here Stored proceure)public static DataTable GetCalendar(DateTime eventdate)
{SqlDataAdapter DA=new SqlDataAdapter("GetCalendar",createConn());
DA.SelectCommand.CommandType=CommandType.StoredProcedure;
DA.SelectCommand.Parameters.Add("@eventdate",eventdate);DataTable DT=new DataTable();
DA.Fill(DT);DA.SelectCommand.Connection.Close();return DT;
}
 
2- User Control Page
 private void Calendar1_SelectionChanged(object sender, System.EventArgs e)
{
DataTable DT=DataAccess.GetCalendar(Calendar1.SelectedDate);if(DT.Rows.Count == 0)
{DGEvent.Visible = false;
}
else
{DGEvent.Visible = true;
DGEvent.DataSource=DT;
DGEvent.DataBind ();
}
 
}private void Calendar1_DayRender(object sender, System.Web.UI.WebControls.DayRenderEventArgs e)
{
DataTable DT2=DataAccess.GetCalendar(Calendar1.SelectedDate);
// If the month is CurrentMonthif (! e.Day.IsOtherMonth )
{for(int i=0 ; i< DT2.Rows.Count;i++)
{if ((DT2.Rows[i]["eventdate"].ToString() != DBNull.Value.ToString()))
{
DateTime dtEvent= (DateTime)DT2.Rows[i]["eventdate"];if (dtEvent.Equals(e.Day.Date))
{
e.Cell.BackColor = Color.PaleVioletRed;
}
}
}
}
//If the month is not CurrentMonth then hide the Dates
else
{
e.Cell.Text = "";
}
}

 
so,  i want the exaclty solution for this problem,plz
 

View 1 Replies View Related

SqlDateTime Overflow. Must Be Between 1/1/1753 12:00:00 AM And 12/31/9999 11:59:59 PM.

Apr 17, 2008

Yes, I've parsed many a topic on many a site regarding this issue.sigh.I am using a calendar control within a TemplateField on a DetailsView.I know that my SQL DB will accept NULL for my DATETIME field, because if I don't bind the control to the insert, the insert succeedes, yeilding a null for DATETIME in the new record.My problem is that I want the user to be able to choose to not select a date.    I find that I have to bind selected value to the insert parameter, so that if they do select a date, it get inserted.( duhh!! )      When I do though, and the user does not select a date, I get the above error.My best guess?  it is sending a datetime value of 00:00:0000 00:00:00 (or something like that anyhow)?So... does anyone have any ideeas on a simple way to evaluate the value when the form is submitted?   and how to set it to NULL if it is, for example "in the past" or "00:00:0000....." ?
,Gary"We truly fail, only when we quit."

View 11 Replies View Related

SqlDateTime Overflow. Must Be Between 1/1/1753 12:00:00 AM And 12/31/9999 11:59:59 PM

Dec 1, 2005

Hi. I am getting the error described in the title - SqlDateTime overflow. I have read what is available online but am still not able to get rid of it. Help much appreciated... thanks.

The Full Error Is:


Code:


System.Data.SqlTypes.SqlTypeException: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM. at System.Data.SqlTypes.SqlDateTime.FromTimeSpan(TimeSpan value) at System.Data.SqlTypes.SqlDateTime.FromDateTime(DateTime value) at System.Data.SqlTypes.SqlDateTime..ctor(DateTime value) at System.Data.SqlClient.MetaType.FromDateTime(DateTime dateTime, Byte cb) at System.Data.SqlClient.TdsParser.WriteValue(Object value, MetaType type, Int32 actualLength, Int32 encodingByteSize, Int32 offset, TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.TdsExecuteRPC(_SqlRPC[] rpcArray, Int32 timeout, Boolean inSchema, SqlNotificationRequest notificationRequest, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at ASP.audiobook_viewdetails_aspx.DetailsView1_ItemInserting(Object Src, DetailsViewInsertEventArgs Args) in C:InetpubwwwrootdushkinmediasupportwebPresentationTieraudiobook_servicesaudiobook_viewdetails .aspx:line 151



And, below is the method that is raising the errors. The
culprit is "created_date" as "DateTime".


Code:


Sub DetailsView1_ItemInserting(ByVal Src As Object, ByVal Args As DetailsViewInsertEventArgs)

'validate the controls

If Args.Values("ISBN") = "" Then
Args.Cancel = True
MSG.Text = "-- Missing ISBN number"
End If

If Args.Values("author_first") = "" Then
Args.Cancel = True
MSG.Text = "-- Missing first name"
End If

If Args.Values("author_last") = "" Then
Args.Cancel = True
MSG.Text = "-- Missing last name"
End If

If Args.Values("publisher") = "" Then
Args.Cancel = True
MSG.Text = "-- Missing Publisher"
End If

If Args.Values("text_description") = "" Then
Args.Cancel = True
MSG.Text = "-- Missing item description"
End If

If Not IsNumeric(Args.Values("regular_price")) Then
Args.Cancel = True
MSG.Text = "-- regular price is not numeric"
Else
If Args.Values("regular_price") < 0 Then
Args.Cancel = True
MSG.Text = "-- regular price is out of range"
End If
End If

If Not IsNumeric(Args.Values("discount_price")) Then
Args.Cancel = True
MSG.Text = "-- Discount price is not numeric"
Else
If Args.Values("discount_price") < 0 Then
Args.Cancel = True
MSG.Text = "-- Discount price is out of range"
End If
End If

'if all the controls are valid, decalre the types
Dim audiobookID As Integer
Dim title As String
Dim author_first As String
Dim author_last As String
Dim publisher As String
Dim ISBN As String
Dim regular_price As String
Dim discount_price As String
Dim text_description As String
Dim created_date As DateTime

' ||||| Set up a Connection Object to the SQL DB
Dim MyConn As System.Data.SqlClient.SqlConnection = New System.Data.SqlClient.SqlConnection("server=ARIA;database=dushkinmedia;Integrated Security=SSPI")
' ||||| Pass in the StoreProcedure or Command String, as well as the Connection object
Dim MyCmd As New System.Data.SqlClient.SqlCommand("sp_RegisterNewAudioBook", MyConn)
' ||||| Set the Command Type (Stored Procedure, Text, etc)
MyCmd.CommandType = System.Data.CommandType.StoredProcedure
' ||||| Create Parameter Objects for values passed in
Dim objParam1, objParam2, objParam3, objParam4, objParam5, objParam6, _
objParam7, objParam8, objParam9, objParam10, objParam11, objParam12, _
objParam13, objParam14, objParam15 As System.Data.SqlClient.SqlParameter
' ||||| Add your parameters to the parameters Collection
objParam1 = MyCmd.Parameters.Add("@audiobookID", Data.SqlDbType.Int)
objParam2 = MyCmd.Parameters.Add("@title", Data.SqlDbType.VarChar)
objParam3 = MyCmd.Parameters.Add("@author_first", Data.SqlDbType.VarChar)
objParam4 = MyCmd.Parameters.Add("@author_last", Data.SqlDbType.VarChar)
objParam5 = MyCmd.Parameters.Add("@publisher", Data.SqlDbType.VarChar)
objParam6 = MyCmd.Parameters.Add("@ISBN", Data.SqlDbType.VarChar)
objParam7 = MyCmd.Parameters.Add("@regular_price", Data.SqlDbType.VarChar)
objParam8 = MyCmd.Parameters.Add("@discount_price", Data.SqlDbType.VarChar)
objParam9 = MyCmd.Parameters.Add("@text_description", Data.SqlDbType.Text)
objParam10 = MyCmd.Parameters.Add("@created_date", Data.SqlDbType.DateTime)
'objParam10 = MyCmd.Parameters.AddWithValue("@img_name", imgName)
objParam11 = MyCmd.Parameters.AddWithValue("@img_data", System.Data.SqlDbType.Image)
'objParam12 = MyCmd.Parameters.AddWithValue("@img_contenttype", imgcontenttype)
'objParam13 = MyCmd.Parameters.AddWithValue("@aud_name", audName)
objParam14 = MyCmd.Parameters.AddWithValue("@aud_data", System.Data.SqlDbType.VarBinary)
'objParam15 = MyCmd.Parameters.AddWithValue("@aud_contenttype", audcontenttype)
' ||||| Set the Parameter values to the passed in values
objParam1.Value = audiobookID
objParam2.Value = title
objParam3.Value = author_first
objParam4.Value = author_last
objParam5.Value = publisher
objParam6.Value = ISBN
objParam7.Value = regular_price
objParam8.Value = discount_price
objParam9.Value = text_description
objParam10.Value = created_date
'objParam11.Value = imgBinaryData
'objParam14.Value = audBinaryData

Try

' ||||| Check if Connection to DB is already open, if not, then open a connection
' ||||| DB not already Open...so open it

MyConn.Open()
MyCmd.ExecuteNonQuery()

' ||||| Close the Connection Closes with it
MyConn.Close()


Catch e As Exception
Beep()
MSG.Text = e.ToString

End Try

'Response.Redirect("~/audiobook_services/audiobook_view.aspx")

End Sub




Any help at all would be MUCH appreciated... Thanks in advance.

View 2 Replies View Related

SqlDateTime Overflow. Must Be Between 1/1/1753 12:00:00 AM And 12/31/9999 11:59:59 PM.

Jun 27, 2006

Hi,

Is there a way to catch the exeption (SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM) with in SQL Server, so it does not need to be caught in the code calling the procedure. E.g. I do not want to send null to the stored procedure.

 

e.g. The stored procedure should be able to catch dates that are outside the range 1/1/1975 and 12/31/9999 and change them to the limits.

E.g.

IF @StartDate < CONVERT(DateTime, '01/01/1753 12:00:00')

BEGIN

    SET @StartDate = CONVERT(DateTime, '01/01/1753 12:00:00')

END

IF @EndDate > CONVERT(DateTime, '01/01/1753 11:59:59')

BEGIN

    SET @EndDate = CONVERT(DateTime, '12/31/9999 11:59:59')

END

 

This still throws an exception because the StartDate or EndDate when tested fail the condition.

View 7 Replies View Related

SQLDATETIME In Bcp File...

Sep 22, 2005

Hi,
i m using sql server 2005 YUKON...and in my format file i have one datetime column..the format of it is as follow :(bulk_format.fmt)

9.0
3
1SQLCHAR 012 " " 1 number SQL_Latin1_General_CP1_CI_AS
2 SQLDATETIME 0 8 " " 2 date_time SQL_Latin1_General_CP1_CI_AS
3SQLCHAR 04 "
" 3alphabet SQL_Latin1_General_CP1_CI_AS


and the format of my input data file is as follow:
12345896236507-08-2005a
56785698412305-06-2009b
91023698547502-08-2003c
35691458963201-02-2000d

now,whenever i m trying to run this in CMD...it gives me the error as:
Starting Copy...
SQLState = 42000, NativeError=4896
error= [microsoft][sql native client][sql server] Invalid column value from bcp client for colid 2
BCP copy in failed.....

So, now can anyone pleaseeeeeeeee tell me..how to deal with this????
any help will be greatly appreciated...
thnks..

View 1 Replies View Related

Converting DateTime To SqlDateTime Format

Mar 30, 2006

Hi,
I have a function that generates a range of DateTimes, which I then cast to SqlDateTime to compare with SqlDateTime values in a database.
The problem is my converted DateTimes come out in this type of format "6/2/2006 12:00:00 AM"
wheras my SqlDateTimes in the database are in this format "2006-01-18T00:00:00.0000000-12:00"
Any ideas how I can convert the DateTime values to SqlDateTime correctly so that I can compare them?  As I said I tried creating a new SqlDateTime object with the DateTime value ie
DateTime dt = new DateTime("");
SqlDateTime sdt = new SqlDateTime(dt);
But that doesn't work correctly, its still not in the format that is in the database.

View 1 Replies View Related

C++ Ole DB Stack Overflow During Sql Server Compilation

Jul 20, 2005

hi,when i execute :CCommand<CManualAccessor, CBulkRowset, CNoMultipleResults> rs;rs.SetRows(100);HRESULT code_resultat = rs.Open(session, requete, &propset, NULL,DBGUID_DBSQL, FALSE);with a requete with length = 13000, it works perfectlybut when my requete length is 200000 (example : SELECT * FROM myTABLEWHERE id_table IN("lot of number : more then 30000 number"))i have code_resultat = DB_E_ERRORSINCOMMAND (= 0x80040e14)and when i explore the IErrorInfo message, i have :minor = 565 and the message issource :Microsoft OLE DB Provider for SQL Serverserveur has made a stack overflow during compilation...Is there a solution to extract to data ?in a fast way ...thanks in advance ...Mike

View 1 Replies View Related

SQL Server 2012 :: Arithmetic Overflow Error For Type Varchar

Mar 11, 2014

I have the following code in a SP. The 2 if statements for the @@ Error I added only for testing as I suddenly started get the following error at the 1st @@Error statement

Msg 232, Level 16, State 2, Line
Arithmetic overflow error for type varchar, value = 10000.00000.

I cannot have this SP running minutes it must be done in seconds.

I have tried the folloiwng changes but then it takes to long.

-- set @new = 'x' + right('0000' + convert(varchar(5), round(rand() * 10000, 0)), 4)
-- set @new = 'x' + right('0000' + convert(varchar(4), right(round(rand() * 10000, 0),4)), 4)

declare @newvarchar(5),
@xstsint,
@new_retvarchar(5)
,@Cnt as int /* just for my testing */
set @cnt = 0 /* just for my testing */

[Code] ......

View 6 Replies View Related

SQL Server 2012 :: Adding Value To Date Column Caused Overflow

Jun 30, 2015

The script is failing at this point "DATEADD(mm, RowNum, salesdate) subscriptionrowdate" dont know exactly where i am going wrong.

This is my code

SELECT *, CAST(viasatsubscriptionid as char(8)) +'_'+LTRIM(STR(RowNum))subscriptionrowlog, DATEADD(mm, RowNum, salesdate) subscriptionrowdate
FROM (
SELECT viasatsubscriptionid, firstproductregistrationdate, salesdate, baseenddate,
ROW_NUMBER() over(Partition by viasatsubscriptionid order by salesdate)-1 RowNum
FROM stage_viasatsubscription
)a

View 9 Replies View Related

Arithmetic Operation Resulted In An Overflow. (System.Data) - Connection Error With SQL Server 2005

Oct 20, 2007

 We've been using SQL Server 2005 for a while as the db for our web app. Everything has been working fine, until yesterday when we started getting a "Arithmetic operation resulted in an overflow. (System.Data)" error message when trying to connect from SQL Server Management Studio or from our web app.  This only happens when trying to connect remotely, although remote connections have worked for us perfectly in the past. The full error message is reproduced below. Thanks ahead of time for any help.  ===================================Cannot connect to serverName===================================Arithmetic operation resulted in an overflow. (System.Data)------------------------------Program Location:   at System.Data.SqlClient.TdsParser.ConsumePreLoginHandshake(Boolean encrypt, Boolean trustServerCert, Boolean& marsCapable)   at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject)   at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject)   at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)   at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)   at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)   at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)   at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)   at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)   at System.Data.SqlClient.SqlConnection.Open()   at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.ObjectExplorer.ValidateConnection(UIConnectionInfo ci, IServerType server)   at Microsoft.SqlServer.Management.UI.ConnectionDlg.Connector.ConnectionThreadUser() 

View 1 Replies View Related

SQL Server 2008 :: Arithmetic Overflow Error Converting Nvarchar To Data Type Numeric

Oct 13, 2012

When I run the following sql query:

"update table set price = price * 1.1 "..

I get the following error : "Msg 8115, Level 16, State 8, Line 1.. Arithmetic overflow error converting nvarchar to data type numeric. The statement has been terminated."

The table is set to nvarchar, and i am just trying to make the prices go up 10%.

View 9 Replies View Related

SQL Server 2012 :: Arithmetic Overflow Error Converting Varchar To Data Type Numeric

Oct 30, 2014

OK, so I have this query where I'm trying to subtract values like this, when I do this I am getting (Arithmetic overflow error converting varchar to data type numeric.) I have tried many different things, and now of these work, it'll either return 0 because it loses the .XXXXX.

Convert(DECIMAL(10,7),CAST([TIME_OF_COMPLETION] as DECIMAL(10,7)) - Convert(DECIMAL(10,7),CAST([OPR_DELIVERED_TIME] as DECIMAL(10,7)) round(cast(cast(hist.[TIME_OF_COMPLETION] AS float) as DECIMAL(15, 5)) - CAST(hist.[OPR_DELIVERED_TIME] AS FLOAT),1 SELECT convert(FLOAT,CAST('735509.00053' AS DECIMAL(10,5))) - convert(FLOAT,CAST('735509.00047' AS DECIMAL(10,5)))

View 1 Replies View Related

Sql Server 2005 Full Text Search Not Working As Expected On Production Server

Jan 28, 2008

I have this simple full text search query that works perfectly on my own computer using sql server 2005 express, however, on the production server(shared hosting)when I added the first 50+ rows,  the full text search works perfect, but as the number of rows increases,  the full text search can only see the first50+ rows, but not the new ones. Is there any quick solution for this or it's just a common mistake for developers for not properly indexed columns?Is there a way to re-indexed all rows without loosing data on the live server? search query: SELECT TOP 50 *FROM li_BookmarksWHERE FREETEXT(Keywords,@Keywords)       

View 2 Replies View Related

How To Setup A Backup Server For SQL Server2005 For Production (in Case The Primary Server Fails)

Aug 1, 2007

I currently have a SQL Server cluster setup with a Primary DB Server SERVER1 and the Standby server SERVER2. SERVER1 has been failing more than normal is the past few weeks and its takes upto 5 mins for SERVER2 realize that SERVER1 is down. I am looking for a better way to implement a backup server on production with minimum downtime. Please adivse..

View 1 Replies View Related

SQL Server 2008 :: Import Table Data From Production To Development Server

Feb 18, 2015

Production and development servers are on different domains and they do not trust each other. How do I import data from the table t1 from a database db1 in production and load it into table t1 inside database db1 in development?

View 3 Replies View Related

Help Needed - How Can I Set Up A Backup SQL Server Machine As An Exact Copy Of My Production SQL Server

Jul 20, 2005

Any help would be greatly appreciated.My problem is that I need to set up a backup SQL Server 2000 machinewhich can be used in case of a failure to my primary. All databases(30 as of now) must be an up to the minute exact copy of productionand include most recent changes in data as well as any structurechanges (Tables, Views, SP's, Triggers, Users . . etc).When I tried this using Transactional Replication, the replicationprocess gets fouled up once I introduce any kind of structure changesto the DB. I've considered the idea of doing periodic backups andrestoring it to my backup SQL server, but this does not give me theconcurrency needed with 0 latency.I've seen articles that recommend using Transaction Replication with'Scheduled Table Refresh', and also doing database dumps to restore onthe backup machine, but I have not been able to find any documentationregarding this to try out. How can I implement this type of backupstrategy in SQL 2000?

View 2 Replies View Related

How To Deploy Reports To Production Server, Do I Need To Have Sql Server Reporting Services Installed Or Just Runtime Files Ok

Apr 23, 2008



I would like to deploy several reports to production server, Do i need to install reporting services entire software in order to run the reports or is it possible to just have runtime files installed on it to run the reports.

please help, i have almost 100 reports to be deployed on this server which is located in other country.

Thanks for the helpful information.

(i am using SQL server 2005 / reporting services 2005.)

View 6 Replies View Related

Moving The .LDF On A Production Server

Dec 7, 2001

ok ok, stop laughing. for real, is there any programatic way of doing this? whom ever created this database i inherited (SQL 2000) created the LDF and DATA files on the same drive and in the same folder for that matter. just trying to do a little disaster magament.

thanks
matt

View 1 Replies View Related

Beta 3 On A Production Server.

Oct 14, 1998

This feels like a silly question, but I`m going to ask it anyway...

I have limited SQL Server experience, but have run into a wall with a client`s Web/Access combination. I need to upgrade to SQL Server. I have Beta3 installed on a development box and am very happy with it. Is anyone running this thing in a production environment? This isn`t going to be experience huge loads, so I`m tempted. Tell me if I`m crazy for wanting to try it.

View 2 Replies View Related

Copy Production Db To Another Server

Jan 31, 2007

I have a brand new database server with system databases.
I need to copy like four production database from another server to this new server. Can i do restore of the last production backups and restore them on the new server without creating the empty databases on the new server.If any one has better approach i will appreciate

View 3 Replies View Related

Production Server Issue

Apr 4, 2008

1.First issue
The port number already allocated was 2059. We have changed that into the default port 1433 in the node. Now we are able to connect the node from the client application. But we are not able to see the configuration manager in any of the environment now.


2. 2nd issue
Cluster Environment




Error while executing the Package The connection details are not loaded in the connection manager tag





The same error with advanced information.





Another error window





R.S.Moorthy

View 1 Replies View Related

Production Server Probs

Nov 9, 2007

I have production server 2000. The server gets disconnected sometime by itself and sometime it is working fine.Sometimes it even doesn't get restarted. Is there any problem with service packs and some performance issues.
Can you SQL guru give me best suggestion and how should i proceed.

View 3 Replies View Related

SQL Server On Production Very Slow

Jan 17, 2007

Hi,I ran test data on my development machine and it took 1 minute toinsert the data. Ran the same set of data on the server and took 5minutes.Check both database and everything is the same. I even copied theproduction DB on my machine and it was taking still about 1 minute.Look at the fragmentation, and all the numbers are better on the serverthan my development machine so it should be faster.In the application I put some timer and discover that the insert istaking 0.015 ms on the server and 0 on the development. So the problemis on the insert.It is a Web application using ASP.NET.Here are the spec of the computers:Development: P4 HT 3.2GHz 1gig memory running WIN XPServer: Xeon 2.8GHz 1.5Gig memory running WIN 2000 serverAny idea how I to pinpoint the problem? I'm not at the point ofthinking that it can be the hardware, but how to verify that?ThanksFrank

View 2 Replies View Related

Acess On Production Server

Jul 12, 2007

Hi,



Presently our Organisation is in process of Implementing SOX.

Under Compliance all the User have to be removed from the Production Server.



1.My Question is Do a DBA Should have Admin Privilages on the Production Server.

If yes then what are the Actitvies that a DBA has to perform only if DBA have admin privilages.



Regards

Sufian





View 2 Replies View Related

Usage Of CLR In Production SQL Server

Nov 6, 2007

Like most enterprise there is the database administrator (dba) and there are the developers(dev). The dba are conservative while the developers are also exploring their options.

One of the current usage I'm experimenting on is to provide data visualization - image for the data. Like most I needed to "create" the System.Drawing assembly in the database, marking it unsafe.

During my testing, my code had some exception and that brought down SQL Server.

I read that the CLR is better compare to the sp_OAs as well as the extended stored procedures written in C++ because it isolates the execution in a separate app domain and termination is clean - in case of any errors, it should not bring down SQL Server.

Also I read marking assembly unsafe void these benefits of isolation.

Instead of having to manage the situation where it involves code review by the dba and asking the dba to take some risk, is there a technique where all CLR code that runs in the production server does not pose stability issues.

View 1 Replies View Related

SP2 On Running Production Server?

May 27, 2007

How can I apply SP2 on running production server if SP resets all protocols (from TCP/IP enabled on production server to Shared Memory enabled) without disrupting its connections and thereafter its work?

View 1 Replies View Related

Auto Restore .bak From Production To Same Server's TEST Db With Other Dbs &&amp; .baks In Same Server.

Aug 10, 2007



Howdy;
I've tried this in the 'tools' area, but that didn't work too well. I suspect, I will have to generate a T-SQL code then schedule it as a job. Why I can't just drag and drop with basic desires, is beyond me, but THAT probably does exist.

anyway here is the problem
[this server has many databases, on SQL 2000 sp2]
1. User only wants me to use Monday morning's full backup, which is good in that it doesn't include transaction logs.
2. Restore that data overtop/into Developement db. = good, no data to worry about damaging.
3. User does NOT want me to do this by hand, but schedule it.

ok,
a. must do a RESTORE WITH FILELISTONLY from [?] what ?, master? and if I user the *.bak of the production, it has
a coded date field in the name entry SO, I would, I guess, have to generate all sorts of wonderful code to find the date and build a file name. Why, because using the FROM DISK = 'F:MSSQLBACKUPDBPRODUCTION_yyyyddmm.BAK' is not going to work with a wild card.
Can I do a file lookup using a 'PRODUCTION' prefix into a variable, then use that or should I look for latest file date [remember there are several database backups here], or ????

then. How does one schedule such a T-SQL. Do I save it to some text file, and invoke it using a job scheduler.

any help appreciated.

IS there an easier way.
rik

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved