Author |
Topic |
|
Suamere
Starting Member
27 Posts |
Posted - 03 January 2005 : 09:56:48
|
So I've read every single ASP tutorial in the world. They are ALL VERY Vague about connecting to databases. In a thousand page tutorial, there might be a paragraph on it. What do I gots to do to get someone to build me an ASP.net page? Then I could use that one page and mold the rest of my code around it... This is my info:
Database Name: HRPDB.mdb Location: Root Folder -> db ODBC DSN: HRPDB Web Page Location: Root Folder -> wwwroot Table Name: Members (Field1, Field2)
Text Box -> Input into Field 1 Text Box -> Input into Field 2 Submit Button
It's amazing how complex people can make code in order for this to be accomplished. Simply inputing a new record with two spaces into a table of a database from a dynamic web site (phew). I don't need uber long code or validations or anything. I can pretty much add anything I need. I basically just need a layout and DSN connection. The DSN really gets me for some reason. Thanks for taking the challenge if you do. |
If something goes wrong, find the source of the problem and break it's legs. |
|
redbrad0
Advanced Member
USA
3725 Posts |
|
Suamere
Starting Member
27 Posts |
Posted - 03 January 2005 : 14:47:29
|
Yeah, thanks though. I've read everything on asp101, and on many other asp sites with tutorials. Maybe it's just me, I actually have that file you linked me to as a possibility on my page. It's http://www.HyruleRP.com/MemberForm2.asp But still, no connection. I know there is something wrong with the DSN part, because if I delete everything and just put a resonse.write there for confirmation, the page won't load. It's nerve wracking when you THINK You know everything you need to, but you don't understand the first initial part. dam DSN. But anyway, I'm having my server people look into why I can't get a connection, maybe it isn't me... |
If something goes wrong, find the source of the problem and break it's legs. |
|
|
redbrad0
Advanced Member
USA
3725 Posts |
|
Suamere
Starting Member
27 Posts |
Posted - 03 January 2005 : 22:39:18
|
Very, VERY Clever, lol. Okay, so I changed it to MemberForm2.aspx. This is just one of many of my failed attempted files, I guess I got it mixed up with asp. Still, No DSN Connection. Perhaps the problem lies in a Namespace. I don't understand that.. is there a file I need called System.data.OleDB? Or is that just included automatically when I put in the "Include Namespace" Code. I can't seem to find a copy of any "Namespaces" to download anywhere so I could put it into my web site... No? |
If something goes wrong, find the source of the problem and break it's legs. |
|
|
redbrad0
Advanced Member
USA
3725 Posts |
|
Nathan
Help Moderator
USA
7664 Posts |
Posted - 05 January 2005 : 03:23:17
|
Put using System.Data.OleDb; at the top of your C# file
OR
<%@ Import Namespace="System.Data.OleDb" %> at the top of your .aspx file
That is all you need to use the classes in the OleDb namespace. |
Nathan Bales CoreBoard | Active Users Download |
|
|
JamesCurran
Starting Member
USA
13 Posts |
Posted - 05 January 2005 : 11:02:01
|
quote: Originally posted by Suamere
So I've read every single ASP tutorial in the world. They are ALL VERY Vague about connecting to databases. In a thousand page tutorial, there might be a paragraph on it. What do I gots to do to get someone to build me an ASP.net page? Then I could use that one page and mold the rest of my code around it... This is my info:
Database Name: HRPDB.mdb Location: Root Folder -> db ODBC DSN: HRPDB Web Page Location: Root Folder -> wwwroot Table Name: Members (Field1, Field2)
I basically just need a layout and DSN connection. The DSN really gets me for some reason.
Forget the DSN. ODBC is old school. You don't need it.
Your connection string should be: "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=db\HRPDB.mdb;User Id=admin;Password=;"
All together, you'll probably want something like:
OleDbConnection myConnection = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\db\northwind.mdb;User Id=admin;Password=;" ); OleDbDataAdapter myCommand = new OleDbDataAdapter("Select LastName, FirstName from Employees", myConnection); DataSet ds = new DataSet(); myCommand.Fill(ds);
|
Truth, James Curran |
|
|
|
Topic |
|