-1

I am using Microsoft ASP.NET web matrix

I have data table called result in MS Access. The name of access file is "roll number".

The table consists of following columns:

Roll number, name,
subject 1, subject 2, subject 3, subject 4, subject 5,
total marks, result

I want that when a user will enter a "roll number" in some textbox and clicks a "submit" button, he is redirected to page showing his results: roll number, name, subject 1..5, total marks and result.

I want it to be two pages like this:

result.aspx          -- where user enters his roll number and submits it

displayresults.aspx  -- where a result is displayed like this:

                        ROLL NUMBER :  (what user entered, looked up in MS Access)
                        NAME :    ("name" read from record from MSAccess file)
                        SUBJECT
                             1 : (mark from "Subject1")
                             2 : (mark from "Subject2")
                             3 : (mark from "Subject3")
                             4 : (mark from "Subject4")
                             5 : (mark from "Subject5")
                        TOTAL MARKS (likewise)
                        RESULT (i.e. PASS/FAIL, as usual, from MSAccess)

How to connect such search engine with data kept in a table from an MS Access database?

Please give complete code to generate the web files.

quetzalcoatl
  • 32,194
  • 8
  • 68
  • 107
  • I tried to understand as much as possible from your question. I think I have preserved 90% of your original thoughts and strived to make them readable and comprehensible. However, I had to fill some gaps where I was unable to see through the original mist. Please review the question after my changes, and feel free to re-edit it and add more details or corrections in case I understood something wrong. – quetzalcoatl Sep 19 '14 at 15:36
  • However, please note that your last request ("please write me the code I need") will probably result in you being scolded upon. You should fetch an ASP.Net tutorial, read it, and simply try to write it yourself. – quetzalcoatl Sep 19 '14 at 15:41
  • have already prepared result.aspx page with a text box and submit button but since I am finding it difficult as to how to link it with access database , I had no other choice than asking for a complete code. – kushal tanna Sep 19 '14 at 15:46

1 Answers1

0

Sorry, but I will not repeat what tutorials say. I will not provide you "the code", as it is mostly trivial, and about any database-querying ASP.NET tutorial will show you how to have a 'textbox that searches for something in a database".

I will only tell you the nontrivial bits:

  • firstly, the MS Access file is not just a file, it can be seen as a database. With some typical tools provided by the .Net or ASP frameworks you will be able to send simple SELECT SQL queries to that database and it will respond with results. How? -> tutorial.

  • most of the tutorials will teach you how to use databases in a "general way"; Tutorials usually does not really care about what database you would like to use. Most of them will will use connectionstrings pointing to a (localdb\v11.0)(or similar), .\sqlexpress, sqlserver, 'localhost', '.' or similar things. This is NOT your case. For working with MS Access files you have to provide a proper OLEDB connection string that will point exactly to that file. Please see this MSDN article and look into "OleDB Connection Strings" section. In very short, the connstring should look like:

    Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\MyPathToMyDatabase\TheFILE.mdb
    
  • after you set up the connection string, you may query the database with any tool you like, be it raw SqlClient, SqlDataSource, LINQ or etc.

  • actually, when speakin about SqlDataSource, ASP.Net even provides you an AccessDataSource. go figure..

quetzalcoatl
  • 32,194
  • 8
  • 68
  • 107