Forums
This topic is locked
Run-time exception thrown :
Posted 18 Aug 2008 20:31:27
1
has voted
18 Aug 2008 20:31:27 anirban chakraborty posted:
following code in vb script arising no error(i.e. debugging without any error, even then not inserting data from those three textbox control into the access database name.mdb having the table details,after clicking the button named btnadd)com.ExecuteNonQuery() Run-time exception thrown : System.Data.OleDb.OleDbException - Operation must use an updateable query.
sub btnadd(sender as object,e as eventargs)
dim con as OleDBConnection
dim com as OleDBCommand
dim str as string
dim i as integer
try
con=new OleDBConnection("provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\WebSite\database2\name.mdb;"
con.open()
str="insert into details values("&(t1.text)&","&(t2.text)&","&Cint(t3.text)&""
com=new OleDBCommand(str,con)
i=com.Executenonquery()
if i>0 then
l1.text="one record added"
end if
catch es as exception
l1.text=es.message
finally
con.close()
end try
end sub
--------------------
<form id="Form1" method="post" runat="server">
<asp:button id="subbtn" onclick="btnadd" Runat="server" Text="run query"></asp:button>
<asp:datagrid id="dtgrid" Runat="server" Width="378px" Height="213px" BorderColor="#ff00ff" AlternatingItemStyle-Font-Bold="True" AlternatingItemStyle-BorderColor="#ff0000"></asp:datagrid>
<asp:TextBox ID="t1" Runat="server"></asp:TextBox><br>
<asp:TextBox ID="t2" Runat="server"></asp:TextBox><br>
<asp:TextBox ID="t3" Runat="server"></asp:TextBox><br>
</form>
PLEASE GIVE DETAILS OF THAT PROBLEM???????????
Anirban Chakraborty