| | |
Connecting to MS Access with PHP
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
Using ODBC is by far the easiest way to do this, since you can connect to any database, on any computer on your network. It happens to be really simple to configure in Administrative Tools as well.
Is there any reason why you can't or don't want to use ODBC?
Is there any reason why you can't or don't want to use ODBC?
Last edited by iamthwee; Jan 12th, 2008 at 7:35 am.
*Voted best profile in the world*
•
•
Join Date: Jan 2008
Posts: 5
Reputation:
Solved Threads: 0
Hi,
Thank you for your reply its not that I dont't want o use it, but I'm trying to create an MS Access database and a web page that gets all its information loaded from the MS Access database using PHP code and upload it onto a server. I' ve been able to do from a MySQL database but this other server only has an MS Access. When I research it says to use an ODBC so I'm lost. Do you have any clue on what I should do.
Thank you
Thank you for your reply its not that I dont't want o use it, but I'm trying to create an MS Access database and a web page that gets all its information loaded from the MS Access database using PHP code and upload it onto a server. I' ve been able to do from a MySQL database but this other server only has an MS Access. When I research it says to use an ODBC so I'm lost. Do you have any clue on what I should do.
Thank you
•
•
Join Date: Nov 2007
Posts: 4
Reputation:
Solved Threads: 1
hey yo I am sorry but that is very dumb..Why use PHP + MS Access that is a sucky combination. You see php is much much better with MySql. If you really need to use MS Access then I recomend you start getting into Asp.Net which just happens to be a little better with both MySql and Ms Access it really does not matter..You know what here is the code if you listen to me.
First things first. Make sure you have referenced System.Data and System.Data.OleDb like this
Then lets say you have a button and a textbox and the button is suppossed to execute a query from an Ms Access database. Lets also say this is the code for the button and textbox within the aspx page.
Then you would have to add this between your <script> tags
And yeah dud that is pretty much it..Trust me it is easier than PHP but anyways w/e..I like PHP too but I only use it with MySql..You can also do what the ppls above me suggested but then there is the issue of accessing remote databases..Lets just say that the database is not in your system how in the hell will you configure the connection..There is no way unless the server does it for you automatically..You dont have that problem with ASP.Net since all you need is the latest version of MDAC wich can be quickly downloaded from Microsoft..Well yeah hopefully this works for ya bud..Peace..
And just to clarify the issue I'm not an egg hater.!
First things first. Make sure you have referenced System.Data and System.Data.OleDb like this
PHP Syntax (Toggle Plain Text)
<%@ Page Language="C#/VB" %> <%@ import Namespace="System.Data" %> <%@ import Namespace="System.Data.OleDb" %>
Then lets say you have a button and a textbox and the button is suppossed to execute a query from an Ms Access database. Lets also say this is the code for the button and textbox within the aspx page.
PHP Syntax (Toggle Plain Text)
<asp:TextBox id="TextBox1" runat="server"> <asp:Button id="Button1" runat="server" text="Execute Query" onclick="Do_Query"></asp:Button>
Then you would have to add this between your <script> tags
PHP Syntax (Toggle Plain Text)
void Do_Query(object sender, EventArgs e) { string strQuery = TextBox1.Text; OleDbConnection Con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=YourDatabase.mdb"); OleDbCommand Com = new OleDbCommand(strQuery, Con); try { Con.Open(); OleDbDataReader dReader = Com.ExecuteReader(); while (dReader.Read()) { //Process Data Here //For example retrieve values } Con.Close(); } catch (OleDbException ex) { Response.Write(ex.ToString()); } }
And yeah dud that is pretty much it..Trust me it is easier than PHP but anyways w/e..I like PHP too but I only use it with MySql..You can also do what the ppls above me suggested but then there is the issue of accessing remote databases..Lets just say that the database is not in your system how in the hell will you configure the connection..There is no way unless the server does it for you automatically..You dont have that problem with ASP.Net since all you need is the latest version of MDAC wich can be quickly downloaded from Microsoft..Well yeah hopefully this works for ya bud..Peace..
And just to clarify the issue I'm not an egg hater.!
•
•
•
•
hey yo I am sorry but that is very dumb..Why use PHP + MS Access that is a sucky combination. You see php is much much better with MySql. If you really need to use MS Access then I recomend you start getting into Asp.Net which just happens to be a little better with both MySql and Ms Access it really does not matter..You know what here is the code if you listen to me.
First things first. Make sure you have referenced System.Data and System.Data.OleDb like this
PHP Syntax (Toggle Plain Text)
<%@ Page Language="C#/VB" %> <%@ import Namespace="System.Data" %> <%@ import Namespace="System.Data.OleDb" %>
Then lets say you have a button and a textbox and the button is suppossed to execute a query from an Ms Access database. Lets also say this is the code for the button and textbox within the aspx page.
PHP Syntax (Toggle Plain Text)
<asp:TextBox id="TextBox1" runat="server"> <asp:Button id="Button1" runat="server" text="Execute Query" onclick="Do_Query"></asp:Button>
Then you would have to add this between your <script> tags
PHP Syntax (Toggle Plain Text)
void Do_Query(object sender, EventArgs e) { string strQuery = TextBox1.Text; OleDbConnection Con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=YourDatabase.mdb"); OleDbCommand Com = new OleDbCommand(strQuery, Con); try { Con.Open(); OleDbDataReader dReader = Com.ExecuteReader(); while (dReader.Read()) { //Process Data Here //For example retrieve values } Con.Close(); } catch (OleDbException ex) { Response.Write(ex.ToString()); } }
And yeah dud that is pretty much it..Trust me it is easier than PHP but anyways w/e..I like PHP too but I only use it with MySql..You can also do what the ppls above me suggested but then there is the issue of accessing remote databases..Lets just say that the database is not in your system how in the hell will you configure the connection..There is no way unless the server does it for you automatically..You dont have that problem with ASP.Net since all you need is the latest version of MDAC wich can be quickly downloaded from Microsoft..Well yeah hopefully this works for ya bud..Peace..
And just to clarify the issue I'm not an egg hater.!
2. Even if you bump an old thread, answer to the point. The OP asked for connecting to ms-access using "PHP" and not .net.
Ignorance is definitely not bliss!
*PM asking for help will be ignored*
*PM asking for help will be ignored*
•
•
Join Date: Jan 2008
Posts: 5
Reputation:
Solved Threads: 0
Hi, I know the idea is dumb and I think it would be better to do it with asp.net like you said but I am not that familiar with asp.net I have tried a couple of times but can't get it to work with asp.net. It's because I don't know it well enough. If you are willing to help me I am willing to try. I have found a DSN-Less connection code in ASP.Net 2.0 that will display the information from the database, but then I don't know and can't figure out code to display the info the way I want it and the pictures. Thanks for your replies.
•
•
•
•
hey yo I am sorry but that is very dumb..Why use PHP + MS Access that is a sucky combination. You see php is much much better with MySql. If you really need to use MS Access then I recomend you start getting into Asp.Net which just happens to be a little better with both MySql and Ms Access it really does not matter..You know what here is the code if you listen to me.
First things first. Make sure you have referenced System.Data and System.Data.OleDb like this
PHP Syntax (Toggle Plain Text)
<%@ Page Language="C#/VB" %> <%@ import Namespace="System.Data" %> <%@ import Namespace="System.Data.OleDb" %>
Then lets say you have a button and a textbox and the button is suppossed to execute a query from an Ms Access database. Lets also say this is the code for the button and textbox within the aspx page.
PHP Syntax (Toggle Plain Text)
<asp:TextBox id="TextBox1" runat="server"> <asp:Button id="Button1" runat="server" text="Execute Query" onclick="Do_Query"></asp:Button>
Then you would have to add this between your <script> tags
PHP Syntax (Toggle Plain Text)
void Do_Query(object sender, EventArgs e) { string strQuery = TextBox1.Text; OleDbConnection Con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=YourDatabase.mdb"); OleDbCommand Com = new OleDbCommand(strQuery, Con); try { Con.Open(); OleDbDataReader dReader = Com.ExecuteReader(); while (dReader.Read()) { //Process Data Here //For example retrieve values } Con.Close(); } catch (OleDbException ex) { Response.Write(ex.ToString()); } }
And yeah dud that is pretty much it..Trust me it is easier than PHP but anyways w/e..I like PHP too but I only use it with MySql..You can also do what the ppls above me suggested but then there is the issue of accessing remote databases..Lets just say that the database is not in your system how in the hell will you configure the connection..There is no way unless the server does it for you automatically..You dont have that problem with ASP.Net since all you need is the latest version of MDAC wich can be quickly downloaded from Microsoft..Well yeah hopefully this works for ya bud..Peace..
And just to clarify the issue I'm not an egg hater.!
![]() |
Similar Threads
- PHP vs ASP... the big ShOwdOwN (IT Professionals' Lounge)
- Problems using a php generator (PHP)
- question about connecting odbc to sql through php script (PHP)
- connecting to access via vb.net-HELP!!! (VB.NET)
- Access Web Database? (Database Design)
- New key word not recoginized in VB6 connecting to Access (Visual Basic 4 / 5 / 6)
Other Threads in the PHP Forum
- Previous Thread: Convert MS Word to HTML via File Upload
- Next Thread: How to Omit the COMMENT text box...??
| Thread Tools | Search this Thread |
.htaccess alexa apache api array beginner beneath binary broadband broken cakephp checkbox class cms code convert cron curl database date display dynamic echo email encode error fcc file files folder form forms function functions google howtowriteathesis href htaccess html image images include insert ip javascript joomla key limit link login mail memberships menu mlm multiple multipletables mysql mysql_real_escape_string network oop open passwords paypal pdf php problem provider query radio random recursion redirect remote rss script search securephp server sessions sms smtp source space sql strip_tags syntax system table template tutorial update upload url user validator variable video voteup web youtube






