hye,

i need help about asp.net..i new in this language. so i don't know how to connect database from ms access to asp.net and submit button.

the situation : when the user click on submit button, the data that they fill in will insert in database.

This forum section is for Classic ASP.

Please take the elevator to the next floor for ASP.NET

first add a namespace to your form for vb.net

imports System.Data.OledDb
//then on button click event write this code
dim con as new OleDbConnection
con.ConectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Work\cvs_root\log4net-1.2\access.mdb;User Id=;Password=;""
Con.open()\\access.mdb is my databasename
dim str as string
try
str="INsert into [table] values ('hi')"
dim cmd=new sqlCommand(str,con)
cmd.ExequteNonquery
 Msgbox ("Recored inserted")
Catch ex as Exception
Mesgbox (ex.Message)
Finally
cmd=nothing
con.close
end try

just add this coding??is it right?

should i open a file in ms access,

yes this code will work..

if you have database at right place..
and database correctly desined

before that go for http://asp.net/learn/

there are plenty of video tutorials..
go through them

To connect MS access database in asp.net put following code in your project web.config file <connectionstring> tag.

<connectionStrings> <add name="myconnection"

connectionString="Provider=Microsoft.Jet.OLEDB.4.0; Data Source= |DataDirectory|db1.mdb"
providerName="System.Data.OleDb"></add>
</connectionStrings>

hi izzatikhalid,

here is the code:

Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
Dim con As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\emp.mdb;")
Dim str="insert into emp values('"& txtName &"','"& txtPassword &"','"& txtAddress &"')"
con.Open()
Dim cmd = New OleDbCommand(str,con)
cmd.executeNonQuery()
con.Close()
End Sub

1. In above example you can put your fielsd name in txtname, txtpassword etc..
2. just change the Data Source="your ms acces table path"
Do write if have prob
Happy coding

okkkkkkkkkkkkkkkkkkkkkkk

To connect MS access database in asp.net put following code in your project web.config file <connectionstring> tag.

<connectionStrings> <add name="myconnection"

connectionString="Provider=Microsoft.Jet.OLEDB.4.0; Data Source= |DataDirectory|db1.mdb"
providerName="System.Data.OleDb"></add>
</connectionStrings>