Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Insert data in Access


Message #1 by "handoyo" <handoyokristanto@y...> on Fri, 29 Mar 2002 13:39:37 +0700
This is a multi-part message in MIME format.

------=_NextPart_000_0065_01C1D727.2B431EC0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Helloo... i want to insert data in ms Access database . But it's always
failed.
At my Data Source i use  : server.mappath  (" 
\BukuASP\BabVI\database.mdb")
and database I save at D:\inetpub\wwwroot\BukuASP\BabVI\database.mdb. 
But
it's failed and  this is the error comment  :

System.Data.OleDb.OleDbException: Operation must use an updateable query

But if i move database.mdb at other directory like
E:\BukuASP\BabVI\database.mdb or D:\Inetpub\database.mdb. --> it's 
success

If I use select SQL command :
  myString =3D "SELECT * from DataUser "  and my data source =3D 
server.mappath
(" \BukuASP\BabVI\database.mdb")
--> it's success.


Why ??

This is my listing program :

  Sub Page_Load(Sender As Object, E As EventArgs)
    Dim myConnection As OleDbConnection
    Dim myCommand As OleDbCommand
    Dim insertstring AS string
    insertstring =3D "INSERT INTO DataUser (Username, Email, Pass, 
S_Question,
S_Answer) Values
('Grasindo', 'Gra@y...', 'dasd', 'Namaku', 'Gras')"
    myConnection =3D New OleDbConnection(
"Provider=3DMicrosoft.Jet.OLEDB.4.0;Data Source=3D" &

server.mappath("\BukuASP\BabVI\database.mdb") &";" )
    myConnection.Open()
    myCommand =3D new OleDbCommand(insertstring, myConnection)
    response.write (insertstring)
    myCommand.Executenonquery()
    myConnection.Close()
  End Sub

Thank you,

Handoyo





_________________________________________________________

Do You Yahoo!?

Get your free @yahoo.com address at http://mail.yahoo.com




  Return to Index