View Full Version : I keep getting this

04-09-2006, 07:39 AM

Am sure this is gonna turn out to have a silly mistake but I cant see it :confused: This form should insert the fields entered in a table but its not I keep getting this error when I start the paege too ... Can anyone see something I dont see :rolleyes:




<%@ Page Language="VB" Debug="true" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.OleDb" %>
<%@ import Namespace="System.Web.UI.WebControls.Table" %>
<script runat="server">

sub btnSave_Click(sender As Object, e As EventArgs)

Dim strAssetType As string = lstAssetType.SelectedIndex
Dim TrackStatus As string = rbtnAssetType.SelectedIndex
Dim Quantity As string = txtQuantity.Text
Dim Name As string = txtName.Text
Dim Description As string = txtDesc.Text
Dim Status As string = selectStatus.SelectedIndex

If lstAssetType.SelectedIndex = 0 and rbtnAssetType.SelectedIndex = 0 and txtQuantity.Text = "" _
and txtName.Text = "" and txtDesc.Text = "" and selectStatus.SelectedIndex = 0 Then

lblMessage.Text = "Please Complete the form."

ElseIF lstAssetType.SelectedIndex <> "0" and rbtnAssetType.SelectedIndex <> "0" and txtQuantity.Text <> "" _
and txtName.Text <> "" and txtDesc.Text <> "" and selectStatus.SelectedIndex <> "0" Then

InsertNewItems(strassetType, trackStatus , name , description ,status ,quantity)
lblMessage.Text = "You have submitted your form successfully"

End if

End Sub

Sub rbtnAssetType_SelectedIndexChanged(sender As Object, e As EventArgs)


End Sub

Private Sub Quantity()

if rbtnAssetType.SelectedIndex = 2 Then
Dim tblSerial as new table

tblSerial.Enabled = false
End if

End Sub

Function InsertNewItems(ByVal strassetType As String, ByVal trackStatus As String, ByVal name As String, ByVal description As String, ByVal status As String, ByVal quantity As Integer) As Integer
Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=C:\Documents an"& _
"d Settings\kdb3684\Desktop\Warehouse_Services_Operations_System\HASEM.mdb"
Dim dbConnection As System.Data.IDbConnection = New System.Data.OleDb.OleDbConnection(connectionString)

Dim queryString As String = "INSERT INTO [tblNewItems] ([AssetType], [TrackStatus], [SerialNo], [AssetTag], [N"& _
"ame], [Description], [Status], [Quantity]) VALUES (@AssetType, @TrackStatus, @Se"& _
"rialNo, @AssetTag, @Name, @Description, @Status, @Quantity)"
Dim dbCommand As System.Data.IDbCommand = New System.Data.OleDb.OleDbCommand
dbCommand.CommandText = queryString
dbCommand.Connection = dbConnection
Dim dbParam_strassetType As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_strassetType.ParameterName = "@strAssetType"
dbParam_strassetType.Value = strassetType
dbParam_strassetType.DbType = System.Data.DbType.[String]
Dim dbParam_trackStatus As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_trackStatus.ParameterName = "@TrackStatus"
dbParam_trackStatus.Value = trackStatus
dbParam_trackStatus.DbType = System.Data.DbType.[String]
Dim dbParam_name As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_name.ParameterName = "@Name"
dbParam_name.Value = name
dbParam_name.DbType = System.Data.DbType.[String]
Dim dbParam_description As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_description.ParameterName = "@Description"
dbParam_description.Value = description
dbParam_description.DbType = System.Data.DbType.[String]
Dim dbParam_status As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_status.ParameterName = "@Status"
dbParam_status.Value = status
dbParam_status.DbType = System.Data.DbType.[String]
Dim dbParam_quantity As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_quantity.ParameterName = "@Quantity"
dbParam_quantity.Value = quantity
dbParam_quantity.DbType = System.Data.DbType.Int32

Dim rowsAffected As Integer = 0
rowsAffected = dbCommand.ExecuteNonQuery
End Try

Return rowsAffected
End Function


Line 62 is this

Dim dbParam_strassetType As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter

04-09-2006, 11:20 AM
Is it the code or the IE?

04-11-2006, 06:50 AM
I have faced such types of error
that was due to script
check the script you hav used

hope this will help

Is it the code or the IE?

04-11-2006, 02:57 PM
I'm not sure, but I think IE referes (line 62) to the sourcecode (View source- HTML) and not your aspx page, because the browser cannot see that. And yes, I also got that message twice, both times because of a script error.

Maybe if your post the html source code, we are able to track down the error.