Click here to Skip to main content
15,880,651 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a problem with connecting the MS access database with ASP.net web application in Vb language. I'm using the Visual Studio 2010 and MS access 2010.If you know the correct coding and the way of connection, and add data to the database with text box, please reply.
Thanks.
Posted
Updated 17-Jan-11 1:16am
v4
Comments
raju melveetilpurayil 17-Jan-11 6:57am    
google your question you will get number of answers. if you need connection string go to http://www.connectionstrings.com/
#realJSOP 17-Jan-11 7:16am    
I changed your tags because many of them were redundant - If it's asp.net involving hooking up a database, the tag "winforms", web development", and "visual studio" are not necessary.

Hi,


Here is complete working code

string ConnectString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" + Server.MapPath("db\\database.mdb;");
       OleDbConnection objCon;
       OleDbCommand objCmd;
       DataSet Ds = new DataSet();

       string GetSql = string.Empty;
       GetSql = "(SELECT * FROM table)";
       using (objCon = new OleDbConnection(ConnectString))
       {
           using (objCmd = new OleDbCommand(GetSql, objCon))
           {
               OleDbDataAdapter Da = new OleDbDataAdapter(objCmd);
               Da.Fill(Ds);
           }
       }


You have to just convert it into vb.net.
 
Share this answer
 
v2
XML
<%@ Import Namespace="System.Data.OleDb" %>
<script runat="server">
sub Page_Load
dim dbconn
dbconn=New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;
data source=" & server.mappath("northwind.mdb"))
dbconn.Open()
end sub
</script>
 
Share this answer
 
Comments
SMRITI1231 13-Jul-13 10:25am    
Is working with asp.net with Access at background advisable or are there better database options
Googled the phrase "asp.net ms-access database", and among the 6.5 MILLION hits returned by google:

http://www.aspfree.com/c/a/Microsoft-Access/Connecting-to-a-Microsoft-Access-database-with-ASPNET/[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900