i am generating a dataset with the following code
Public Sub doInsert(ByVal sender As Object, ByVal e As DataGridCommandEventArgs)
If e.CommandName = "Insert" Then
Dim storID As String
Dim txtStorID As TextBox
txtStorID = e.Item.FindControl("add_storID")
storID = txtStorID.Text
Dim storName As String
Dim txtStorName As TextBox
txtStorName = e.Item.FindControl("add_storName")
storName = txtStorName.Text
Dim storAddress As String
Dim txtStorAddress As TextBox
txtStorAddress = e.Item.FindControl("add_storAddress")
storAddress = txtStorAddress.Text
Dim storCity As String
Dim txtStorCity As TextBox
txtStorCity = e.Item.FindControl("add_city")
storCity = txtStorCity.Text
Dim storState As String
Dim txtStorState As TextBox
txtStorState = e.Item.FindControl("add_state")
storState = txtStorState.Text
Dim storZip As String
Dim txtStorZip As TextBox
txtStorZip = e.Item.FindControl("add_zip")
storZip = txtStorZip.Text
Dim strSQL As String
strSQL = "INSERT INTO STORES (id, storname, storaddress, city, state, zip) " _
& "VALUES (@ID, @storeName, @storeAddr,@city,@state,@zip)"
Const strConnStr As String = "Provider=MSDAORA.1;user id=schmirv2;data source="";password=""
'Dim con As New OleDb.OleDbConnection(ConfigurationSettings.AppSettings("conn"))
Dim con As New OleDb.OleDbConnection(strConnStr)
con.Open()
Dim cmdExp As New OleDb.OleDbCommand(strSQL, con)
'cmdExp.CommandType = CommandType.Text
'con = New SqlConnection(ConfigurationSettings.AppSettings("conn"))
'cmdExp = New SqlCommand(strSQL, con)
Dim storIDParam As New OleDb.OleDbParameter("@ID", OleDb.OleDbType.Double, 50)
storIDParam.Value = storID
cmdExp.Parameters.Add(storIDParam)
Dim storNameParam As New OleDb.OleDbParameter("@storeName", OleDb.OleDbType.VarChar, 50)
storNameParam.Value = storName
cmdExp.Parameters.Add(storNameParam)
Dim storAddParam As New OleDb.OleDbParameter("@storeAddr", OleDb.OleDbType.VarChar, 50)
storAddParam.Value = storAddress
cmdExp.Parameters.Add(storAddParam)
Dim storCityParam As New OleDb.OleDbParameter("@city", OleDb.OleDbType.VarChar, 50)
storCityParam.Value = storCity
cmdExp.Parameters.Add(storCityParam)
Dim storStateParam As New OleDb.OleDbParameter("@state", OleDb.OleDbType.VarChar, 50)
storStateParam.Value = storState
cmdExp.Parameters.Add(storStateParam)
Dim storZipParam As New OleDb.OleDbParameter("@zip", OleDb.OleDbType.VarChar, 50)
storZipParam.Value = storZip
cmdExp.Parameters.Add(storZipParam)
cmdExp.ExecuteNonQuery()
con.Close()
dgStores.EditItemIndex = -1
BindData()
End If
basically when i compile i get the error
System.Data.OleDb.OleDbException: One or more errors occurred during processing of command. ORA-00936: missing expression
i also get the following error sometimes
System.InvalidCastException: Object must implement IConvertible
how can i fix this error so that i can insert into my datagrid
No one has replied yet! Why not be the first?
Sign in or Join us (it's free).