Click here to Skip to main content
15,878,852 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: format date Pin
Marcus J. Smith22-Feb-07 8:19
professionalMarcus J. Smith22-Feb-07 8:19 
GeneralRe: format date Pin
alexfromto22-Feb-07 8:22
alexfromto22-Feb-07 8:22 
GeneralRe: format date Pin
Marcus J. Smith22-Feb-07 9:04
professionalMarcus J. Smith22-Feb-07 9:04 
GeneralRe: format date Pin
jds120722-Feb-07 8:43
jds120722-Feb-07 8:43 
GeneralRe: format date Pin
alexfromto22-Feb-07 8:53
alexfromto22-Feb-07 8:53 
AnswerRe: format date Pin
Dave Kreskowiak22-Feb-07 8:45
mveDave Kreskowiak22-Feb-07 8:45 
GeneralRe: format date Pin
alexfromto22-Feb-07 8:58
alexfromto22-Feb-07 8:58 
GeneralRe: format date Pin
jds120722-Feb-07 9:22
jds120722-Feb-07 9:22 
I have tried using parameterized queries and when I run the program I get the error "Failed to convert parameter value from a String to a DateTime."

Code:

MyCommand.CommandText = "INSERT INTO ls_orderitems (OrderDate, OrderCustomer, OrderAcctNum, OrderType, OrderSoNum, OrderItemPartNum, OrderItemPartDesc, OrderItemQty, OrderItemQtyRec, OrderItemQtyDtRec, OrderItemBO, OrderItemBODt,OrderItemCanceled, OrderItemCanceledDt, OrderItemNotes, OrderItemPONum, OrderItemRetailPrice, OrderItemSalePrice, Status, InsertDate) VALUES (@OrderDate, @OrderCustomer, @OrderAcctNum, @OrderType, @OrderSoNum, @OrderItemPartNum, @OrderItemPartDesc, @OrderItemQty, @OrderItemQtyRec, @OrderItemQtyDtRec, @OrderItemBO, @OrderItemBODt, @OrderItemCanceled, @OrderItemCanceledDt, @OrderItemNotes, @OrderItemPONum, @OrderItemRetailPrice, @OrderItemSalePrice, @Status, @InsertDate)"

MyCommand.Parameters.Add(New Odbc.OdbcParameter("@OrderDate", OdbcType.Date)).Value = OrderDate

MyCommand.Parameters.Add(New Odbc.OdbcParameter("@OrderCustomer", OdbcType.VarChar)).Value = OrderCustomer

MyCommand.Parameters.Add(New Odbc.OdbcParameter("@OrderAcctNum", OdbcType.VarChar)).Value = OrderAcctNum

MyCommand.Parameters.Add(New Odbc.OdbcParameter("@OrderType", OdbcType.VarChar)).Value = OrderType

MyCommand.Parameters.Add(New Odbc.OdbcParameter("@OrderSoNum", OdbcType.Int)).Value = OrderSoNum

MyCommand.Parameters.Add(New Odbc.OdbcParameter("@OrderItemPartNum", OdbcType.VarChar)).Value = OrderItemPartNum

MyCommand.Parameters.Add(New Odbc.OdbcParameter("@OrderItemPartDesc", OdbcType.VarChar)).Value = OrderItemPartDesc

MyCommand.Parameters.Add(New Odbc.OdbcParameter("@OrderItemQty", OdbcType.Int)).Value = OrderItemQty

MyCommand.Parameters.Add(New Odbc.OdbcParameter("@OrderItemQtyRec", OdbcType.Int)).Value = OrderItemQtyRec

MyCommand.Parameters.Add(New Odbc.OdbcParameter("@OrderItemQtyDtRec", OdbcType.Date)).Value = OrderItemQtyDtRec

MyCommand.Parameters.Add(New Odbc.OdbcParameter("@OrderItemBO", OdbcType.Int)).Value = OrderItemBO

MyCommand.Parameters.Add(New Odbc.OdbcParameter("@OrderItemBODt", OdbcType.Date)).Value = OrderItemBODt

MyCommand.Parameters.Add(New Odbc.OdbcParameter("@OrderItemCanceled", OdbcType.Int)).Value = OrderItemCanceled

MyCommand.Parameters.Add(New Odbc.OdbcParameter("@OrderItemCanceledDt", OdbcType.Date)).Value = OrderItemCanceledDt

MyCommand.Parameters.Add(New Odbc.OdbcParameter("@OrderItemNotes", OdbcType.VarChar)).Value = OrderItemNotes

MyCommand.Parameters.Add(New Odbc.OdbcParameter("@OrderItemPONum", OdbcType.VarChar)).Value = OrderItemPONum

MyCommand.Parameters.Add(New Odbc.OdbcParameter("@OrderItemRetailPrice", OdbcType.VarChar)).Value = OrderItemRetailPrice

MyCommand.Parameters.Add(New Odbc.OdbcParameter("@OrderItemSalePrice", OdbcType.VarChar)).Value = OrderItemSalePrice

MyCommand.Parameters.Add(New Odbc.OdbcParameter("@Status", OdbcType.Int)).Value = Status

MyCommand.Parameters.Add(New Odbc.OdbcParameter("@InsertDate", OdbcType.VarChar)).Value = InsertDate

MyCommand.Connection = MyConnection
MyConnection.Open()
MyCommand.ExecuteNonQuery()
MyConnection.Close()

Am I doing something wrong?
GeneralRe: format date Pin
Dave Kreskowiak22-Feb-07 9:27
mveDave Kreskowiak22-Feb-07 9:27 
GeneralRe: format date Pin
tonymathewt22-Feb-07 17:06
professionaltonymathewt22-Feb-07 17:06 
GeneralRe: format date Pin
Dave Kreskowiak23-Feb-07 2:08
mveDave Kreskowiak23-Feb-07 2:08 
QuestionExchange Pin
alexfromto22-Feb-07 7:27
alexfromto22-Feb-07 7:27 
AnswerRe: Exchange Pin
Dave Kreskowiak22-Feb-07 8:41
mveDave Kreskowiak22-Feb-07 8:41 
GeneralRe: Exchange Pin
alexfromto22-Feb-07 9:03
alexfromto22-Feb-07 9:03 
GeneralRe: Exchange Pin
Dave Kreskowiak22-Feb-07 9:22
mveDave Kreskowiak22-Feb-07 9:22 
GeneralRe: Exchange Pin
alexfromto22-Feb-07 9:30
alexfromto22-Feb-07 9:30 
GeneralRe: Exchange Pin
Dave Kreskowiak22-Feb-07 9:59
mveDave Kreskowiak22-Feb-07 9:59 
GeneralRe: Exchange Pin
alexfromto22-Feb-07 10:40
alexfromto22-Feb-07 10:40 
GeneralRe: Exchange Pin
Dave Kreskowiak22-Feb-07 11:57
mveDave Kreskowiak22-Feb-07 11:57 
QuestionDisplaying forms Pin
jady8422-Feb-07 7:17
jady8422-Feb-07 7:17 
AnswerRe: Displaying forms Pin
Dave Kreskowiak22-Feb-07 8:38
mveDave Kreskowiak22-Feb-07 8:38 
AnswerRe: Displaying forms Pin
TwoFaced22-Feb-07 9:10
TwoFaced22-Feb-07 9:10 
QuestionOleDB error Pin
7prince22-Feb-07 7:10
7prince22-Feb-07 7:10 
AnswerRe: OleDB error Pin
Dave Kreskowiak22-Feb-07 8:36
mveDave Kreskowiak22-Feb-07 8:36 
GeneralRe: OleDB error Pin
7prince22-Feb-07 12:55
7prince22-Feb-07 12:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.