L
Learner
Hello,
I am trying to store the data entered in a webform in the database. I
have few Int and one SmallDateTime filed in my table in SQL Server 2005
database. I have made a storedproc to store the values.
My parameters in the database are like this
@DealerShipID int,
@ReturnDate smallDateTime,
@Odometer varchar(6),
@Year int,
@MakeID int,
@ModelID int,
@SubModelID int
here is what I am trying to do to convert the data that was entered in
the webform to its correspoding type
CInt(_drplDealerShips.DataValueField.Trim), _
CDate(_txtReturnDate.Text.Trim), _
_txtOdometer.Text.Trim,
_
CInt(_txtYear.Text.Trim), _
CInt(_drplMake.DataValueField.Trim), _
CInt(_drplModels.DataValueField.Trim), _
CInt(_txtSubModel.Text.Trim)
But when I debug the application it is complaining about the below
error :
******************************************************************************
System.InvalidCastException was unhandled by user code
Message="Conversion from string "DealerShipID" to type 'Integer' is
not valid."
Source="Microsoft.VisualBasic"
StackTrace:
at
Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String
Value)
at NewVehicleFeed._btnNewVehicleFeedSave_Click(Object sender,
EventArgs e) in C:\Documents and Settings\devi\My Documents\Visual
Studio 2005\WebSites\GroundingDemo\NewVehicleFeed.aspx.vb:line 39
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String
eventArgument)
at
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection
postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
*************************************************************************************
Could any body suggest me how do I convert the string values into Int
and SmallDateTime values?
Thanks
-L
I am trying to store the data entered in a webform in the database. I
have few Int and one SmallDateTime filed in my table in SQL Server 2005
database. I have made a storedproc to store the values.
My parameters in the database are like this
@DealerShipID int,
@ReturnDate smallDateTime,
@Odometer varchar(6),
@Year int,
@MakeID int,
@ModelID int,
@SubModelID int
here is what I am trying to do to convert the data that was entered in
the webform to its correspoding type
CInt(_drplDealerShips.DataValueField.Trim), _
CDate(_txtReturnDate.Text.Trim), _
_txtOdometer.Text.Trim,
_
CInt(_txtYear.Text.Trim), _
CInt(_drplMake.DataValueField.Trim), _
CInt(_drplModels.DataValueField.Trim), _
CInt(_txtSubModel.Text.Trim)
But when I debug the application it is complaining about the below
error :
******************************************************************************
System.InvalidCastException was unhandled by user code
Message="Conversion from string "DealerShipID" to type 'Integer' is
not valid."
Source="Microsoft.VisualBasic"
StackTrace:
at
Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String
Value)
at NewVehicleFeed._btnNewVehicleFeedSave_Click(Object sender,
EventArgs e) in C:\Documents and Settings\devi\My Documents\Visual
Studio 2005\WebSites\GroundingDemo\NewVehicleFeed.aspx.vb:line 39
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String
eventArgument)
at
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection
postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
*************************************************************************************
Could any body suggest me how do I convert the string values into Int
and SmallDateTime values?
Thanks
-L