PC Review Forums Newsgroups Microsoft DotNet Microsoft ADO .NET how to connect asp.net with MS-access and also how to pass data t

Reply

how to connect asp.net with MS-access and also how to pass data t

 
Thread Tools Rate Thread
Old 14-09-2006, 02:01 AM   #1
=?Utf-8?B?SmFjaw==?=
Guest
 
Posts: n/a
Default how to connect asp.net with MS-access and also how to pass data t


hI,

Anyone here know how to connect asp.net with MS-access and also how to pass
data to a table?

The following is the code which I have but unfortunately its not working..
Public Connectionstring As String =
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source =
C:\Inetpub\wwwroot\Dee\ASPdotnet\currt.mdb;Persist Security Info=False;"
Public con As New OleDbConnection(Connectionstring)


Dim strSelect As String
strSelect = "Insert Into UserDetails1 (Username) Values
(@DetailsUser)"
Dim cmd As New OleDbCommand(strSelect, con)
Dim added As Integer
cmd.Parameters.Add("@DetailsUser", txtUserDetails.Text)

Try
con.Open()
cmd.ExecuteNonQuery()
Response.Write("Updated Successfully!<p> </p><p> </p><p> </p>")

con.Close()
Response.Write("Updated Successfully!<p> </p><p> </p><p> </p>")
Catch
con.Close()
End Try



Thanks in advance
Jack

  Reply With Quote
Old 14-09-2006, 05:44 AM   #2
Cor Ligthert [MVP]
Guest
 
Posts: n/a
Default Re: how to connect asp.net with MS-access and also how to pass data t

Jack,

About what you are asking is broad, but this website can give you a
quickstart

http://samples.gotdotnet.com/quickstart/

I hope this helps,

Cor

"Jack" <Jack@discussions.microsoft.com> schreef in bericht
news:9A4FC764-034C-4C11-8E21-723A6F2779DF@microsoft.com...
> hI,
>
> Anyone here know how to connect asp.net with MS-access and also how to
> pass
> data to a table?
>
> The following is the code which I have but unfortunately its not working..
> Public Connectionstring As String =
> "Provider=Microsoft.Jet.OLEDB.4.0;Data Source =
> C:\Inetpub\wwwroot\Dee\ASPdotnet\currt.mdb;Persist Security Info=False;"
> Public con As New OleDbConnection(Connectionstring)
>
>
> Dim strSelect As String
> strSelect = "Insert Into UserDetails1 (Username) Values
> (@DetailsUser)"
> Dim cmd As New OleDbCommand(strSelect, con)
> Dim added As Integer
> cmd.Parameters.Add("@DetailsUser", txtUserDetails.Text)
>
> Try
> con.Open()
> cmd.ExecuteNonQuery()
> Response.Write("Updated Successfully!<p> </p><p> </p><p> </p>")
>
> con.Close()
> Response.Write("Updated Successfully!<p> </p><p> </p><p> </p>")
> Catch
> con.Close()
> End Try
>
>
>
> Thanks in advance
> Jack
>



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off