D
dancer
Using Asp.net 1.1
Can somebody tell me why the code following gives this error message:
Compilation Error
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.
Compiler Error Message: BC30456: 'String' is not a member of
'System.Data.OleDb.OleDbType'.
Source Error:
Line 21: Dim TheNotifyDate as string = NotifyDate.Text
Line 22:
Line 23: Dim parameterTheEmpName as OleDbParameter = new
OleDbParameter("@TheEmpName", OleDbType.String)
Line 24:
Line 25: Response.Write("Value of TheEmpName = " & TheEmpName & "<br>")
<%@ Page Language="VB" Debug="true" %>
<%@ Import Namespace="System.Data.Oledb" %>
<script language= "VB" runat="server">
'Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs)
Sub btnSendDatabase_OnClick(Source As Object, E As EventArgs)
Dim DBConnection As OledbConnection
DBConnection = New OledbConnection("Provider=Microsoft.Jet.Oledb.4.0;" & _
"Data Source=C:\Inetpub\wwwroot\Acc.mdb" )
DBConnection.Open()
Dim DBCommand As OledbCommand
DBCommand = New OledbCommand("SELECT * FROM table1, Acc")
Dim SQLString AS String
Dim TheEmpName as String = EmpName.Text
Dim TheDateOfAccident as string = DateOfAccident.Text
Dim TheNotifyDate as string = NotifyDate.Text
Dim parameterTheEmpName as OleDbParameter = new
OleDbParameter("@TheEmpName", OleDbType.String)
Response.Write("Value of TheEmpName = " & TheEmpName & "<br>")
SQLString = "INSERT INTO Table1(TheEmpName, TheDate,
TheNotifyDate)VALUES(@TheEmpName,@TheDateOfAccident,@TheNotifyDate)"
DBCommand = New OleDBCommand(SQLString, DBConnection)
DBCommand.ExecuteNonquery()
Response.Write("Value of TheEmpName = " & TheEmpName & "<br>")
Dim Cmd as New OleDbCommand(SQLString, DBConnection)
With cmd.Parameters:
..Add(New OleDbParameter("@TheEmpName", EmpName.Text))
..Add(New OleDbParameter("@TheDateOfAccident", DateOfAccident.Text))
..Add(New OleDbParameter("@TheNotifyDate", NotifyDate.Text))
end With
DBConnection.Close()
Response.Write("Value of TheEmpName = " & TheEmpName & "<br>")
End Sub
</script>
</head>
<body>
<form id="form1" runat="server">
Employee's Name: <asp:textbox id="EmpName" runat=server columns="45"/>
<asp:textbox id="DateofAccident" runat=server /></asp:textbox>
<font face="Verdana" Size="2">Date Employer Notified <asp:textbox
id="Notifydate" runat=server/>
<asp:Button id="btnSendDatabase" text="Submit"
OnClick="btnSendDatabase_OnClick" runat="server" />
</form>
</body>
</html>
Can somebody tell me why the code following gives this error message:
Compilation Error
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.
Compiler Error Message: BC30456: 'String' is not a member of
'System.Data.OleDb.OleDbType'.
Source Error:
Line 21: Dim TheNotifyDate as string = NotifyDate.Text
Line 22:
Line 23: Dim parameterTheEmpName as OleDbParameter = new
OleDbParameter("@TheEmpName", OleDbType.String)
Line 24:
Line 25: Response.Write("Value of TheEmpName = " & TheEmpName & "<br>")
<%@ Page Language="VB" Debug="true" %>
<%@ Import Namespace="System.Data.Oledb" %>
<script language= "VB" runat="server">
'Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs)
Sub btnSendDatabase_OnClick(Source As Object, E As EventArgs)
Dim DBConnection As OledbConnection
DBConnection = New OledbConnection("Provider=Microsoft.Jet.Oledb.4.0;" & _
"Data Source=C:\Inetpub\wwwroot\Acc.mdb" )
DBConnection.Open()
Dim DBCommand As OledbCommand
DBCommand = New OledbCommand("SELECT * FROM table1, Acc")
Dim SQLString AS String
Dim TheEmpName as String = EmpName.Text
Dim TheDateOfAccident as string = DateOfAccident.Text
Dim TheNotifyDate as string = NotifyDate.Text
Dim parameterTheEmpName as OleDbParameter = new
OleDbParameter("@TheEmpName", OleDbType.String)
Response.Write("Value of TheEmpName = " & TheEmpName & "<br>")
SQLString = "INSERT INTO Table1(TheEmpName, TheDate,
TheNotifyDate)VALUES(@TheEmpName,@TheDateOfAccident,@TheNotifyDate)"
DBCommand = New OleDBCommand(SQLString, DBConnection)
DBCommand.ExecuteNonquery()
Response.Write("Value of TheEmpName = " & TheEmpName & "<br>")
Dim Cmd as New OleDbCommand(SQLString, DBConnection)
With cmd.Parameters:
..Add(New OleDbParameter("@TheEmpName", EmpName.Text))
..Add(New OleDbParameter("@TheDateOfAccident", DateOfAccident.Text))
..Add(New OleDbParameter("@TheNotifyDate", NotifyDate.Text))
end With
DBConnection.Close()
Response.Write("Value of TheEmpName = " & TheEmpName & "<br>")
End Sub
</script>
</head>
<body>
<form id="form1" runat="server">
Employee's Name: <asp:textbox id="EmpName" runat=server columns="45"/>
<asp:textbox id="DateofAccident" runat=server /></asp:textbox>
<font face="Verdana" Size="2">Date Employer Notified <asp:textbox
id="Notifydate" runat=server/>
<asp:Button id="btnSendDatabase" text="Submit"
OnClick="btnSendDatabase_OnClick" runat="server" />
</form>
</body>
</html>