Advertisement

04.07.2008 at 08:07AM PDT, ID: 23301593
[x]
Attachment Details

SQL INSERT Not working Oracle Returns ORA-00936: missing expression

Asked by k_smee in .Net Editors & IDEs, Oracle Database, Microsoft Visual Basic.Net

Tags: VB.NET, Oracle

I am working \ struggling with a school prjoect and am stuck. I have an HTML form generated with an .aspx file (attached) that asks a user to fill in text boxes to insert a new SALE record in a remote Oracle DB. I keep getting ORA-00936: missing expression and I don't know what is missing. Thanks!
Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
<%@Page language="vb" explicit="true" debug="true"%>
<%@Import Namespace="System.Data"%>
<%@Import Namespace="System.Data.OleDb"%>
 
<script runat="server">
Sub Page_Load(sender As Object, e As EventArgs)
If Page.IsPostback then
	InsertRecord()
End If
End Sub
 
Sub InsertRecord()
 
Dim conClasf As OleDbConnection
Dim cmdClasf As New OleDbCommand
Dim strClasf As String
Dim strSQL As String
Dim intRowsAff As Integer
 
 
lblErrMsg.Text = ""
lblRecsAff.Text = ""
 
 
     conClasf = New OleDbConnection( _
     "Provider=OraOLEDB.Oracle;Persist Security Info=False;" & _
     "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=nova.umuc.edu)" & _
     "(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=acad)));User Id=CM485B09;Password=d5h6x7e6;")
     conClasf.Open
 
        
strSQL = "INSERT INTO sale VALUES (" & intSaleID.Value & ", " & intAgentID.Value & _
	    ", " & intHomeID.Value & ", "' & intCustID.Value & _
	    '", " & intContractID.Value & ", "' & saleDate.Value & '", " & saleAmount.Value & ") "
 
cmdClasf = New OleDbCommand(strSQL, conClasf)
Try
	intRowsAff = cmdClasf.ExecuteNonQuery()
Catch ex as exception
	lblErrMsg.Text = ex.Message
End Try
 
lblRecsAff.Text = intRowsAff & "record(s) inserted"
 
conClasf.Close 
 
End Sub
</script>
<html>
 
<head>
<title>Insert New Sale</title>
</head>
[+][-]04.07.2008 at 08:12AM PDT, ID: 21297687

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: .Net Editors & IDEs, Oracle Database, Microsoft Visual Basic.Net
Tags: VB.NET, Oracle
Sign Up Now!
Solution Provided By: angelIII
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628