how to insert record to dbf file via asp net

S

Sharon

I have a problem using with dbf file here. I have tried the code below using
VB.NET with no errors. However, I use the exact same code in ASP NET, it
prompt me error when I tried to insert a record.


The error Detail :

ERROR [HY000] [Microsoft][ODBC dBase Driver] Operation must use an
updateable query.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Data.Odbc.OdbcException: ERROR [HY000]
[Microsoft][ODBC dBase Driver] Operation must use an updateable query.

Source Error:

Line 213:
Line 214: Catch ex As OdbcException
Line 215: Throw (ex)
Line 216:
Line 217: Finally

Source File: c:\inetpub\wwwroot\eClinicApp\DownloadVisit.aspx.vb Line:
215

Stack Trace:

[OdbcException: ERROR [HY000] [Microsoft][ODBC dBase Driver] Operation must
use an updateable query.]
eClinicApp.DownloadVisit.btnDownload_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\eClinicApp\DownloadVisit.aspx.vb:215
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain() +1277




The Code for this is as follow,

Dim myCMD As New OdbcCommand

Dim cnSqlServer1 As New
OdbcConnection("CollatingSequence=ASCII;PageTimeout=600;UserCommitSync=Yes;MaxScanRows=8;DefaultDir=C:\seagate\data;FILEDSN=C:\seagate\data\COY.DBF.dsn;DriverId=21;Deleted=1;Statistics=0;FIL=dBase
III;UID=admin;Driver={Driver do Microsoft dBase
(*.dbf)};MaxBufferSize=2048;Threads=3;SafeTransactions=0")


myCMD.Connection = cnSqlServer1
myCMD.CommandType = CommandType.Text
myCMD.CommandText = _
"INSERT INTO [VisitD]([ACNO],[NAME],[NRIC],[EMPNO],[DIV]) " & _
"VALUES(" & _
"'" & dsVisit.Tables(0).Rows(0).Item("ACNO") & "', " & _
"'" & dsVisit.Tables(0).Rows(0).Item("NAME") & "', " & _
"'" & dsVisit.Tables(0).Rows(0).Item("NRIC") & "', " & _
"'" & dsVisit.Tables(0).Rows(0).Item("EMPNO") & "', " & _
"'" & dsVisit.Tables(0).Rows(0).Item("DIV") & "') "

Try
myCMD.Connection.Open()
myCMD.ExecuteNonQuery()




Catch ex As OdbcException
Throw (ex)

Finally
myCMD.Connection.Close()
End Try


Does anyone know what happen? Please help.

Regards
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,078
Latest member
MakersCBDBlood

Latest Threads

Top