Access Conection with VB.net

Discussion in 'Databases' started by villagecirc, Nov 10, 2003.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I have read through the posts trying to understand how to connect my Access data base to my aspx page but am haveing trouble understanding just what i need to do.... I have placed the data base within the root folder at e:\web\villagecirc\htdocs\_database\bt.mdb and can not access it through a database conection using Jet ole db 4.0. I have gathered through trial and error and some previous post that this is incorect way to do it. I have also tried importing it using front page but am not quite sure what and how to do that that The directions were fairly strait forward but I would not know what to do even if I properly inported the data base.... Any and all help in the matter would be greatly apreciated.....I am very tempted to activate ms SQL but am not quite sure how to use it and do not want to commit the money on a resource I don't quite understand. I understand the benefits of MS SQL with its multithreading functionality but only need to display some info from a database and close it right away I am getting frustrated with connecting[V] the access database.....

    Matthew H. Paulson
    [email protected]
    http://webpages.charter.net/bctrotzer/
     
  2. I don't know which error you receive, but here is the way I connect to my databases:

    First of all, Define your connectionstring you want to use in your web.config file. Add a key to the appSettings-part. Afterwards, you can easily get your connectionstring back. see next
     
  3. thank you for your help I did want it in C# don't know why I said VB.net I was able to edit the web config file correctly but am getting an error message on the line declaring
    "Public Static DataSet ReturnDataset(string cmdText) for some reason it does not like "DataSet" the error message states
    "C:\Documents and Settings\smpaulson\VSWebCache\www.villagecircle.net\BeyondTherapy\WebForm1.aspx.cs(24): The type or namespace name 'DataSet' could not be found (are you missing a using directive or an assembly reference?)

    I did add the using statement "using system.data.oledb"

    Any and all help in the matter is greatly apreciated and I thank you for your help thus far....[?]


    Matthew H. Paulson
    [email protected]
    http://webpages.charter.net/bctrotzer/
     
  4. I am haveing problems with the conection string within the webconfig file at www.villagecircle.net/Test/Test.aspx it is a server error in '/Test' Aplication --

    Line 3: <appSettings>
    Line 4: <!-- add this kind of key -->
    Line 5: <add key="MyConn" provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\web\villagecirc\htdocs\_database\bt.mdb />
    Line 6: </appSettings>
    Line 7: <system.web>

    it does not like line 5 does something look out of place

    Line 5: <add key="MyConn" provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\web\villagecirc\htdocs\_database\BT.mdb />

    I have double checked my root server path and have cut and paste it
    to ensure this is not the problem e:\web\villagecirc\htdocs
    I have double checked the database name it is caped BT.mdb

    Once I get past the webconfig I have some errors within my aplication

    C:\Documents and Settings\smpaulson\VSWebCache\www.villagecircle.net\Test\Test.aspx.cs(31): The type or namespace name 'FrosCommBL' could not be found (are you missing a using directive or an assembly reference?)

    C:\Documents and Settings\smpaulson\VSWebCache\www.villagecircle.net\Test\Test.aspx.cs(58): The type or namespace name 'ConfigurationSettings' could not be found (are you missing a using directive or an assembly reference?)

    I have absolutely no idea what 'FrosCommBL' is nor if it derives from a certain using statement?

    If I am beyond help and am annoying you I will understand and apreciate the help you have given me thus far but would greatly apreciate any further assistance in the matter as many times it is just a matter of adding key using statements and or a simple syntax error. I will look at the syntax of other connection strings as I am unfamiliar with the proper syntax regarding conection strings and see if I can figure it out thanx again for your time.[:)]






    Matthew H. Paulson
    [email protected]
    http://webpages.charter.net/bctrotzer/
     
  5. I think your line 5 should read:
    <add key="myConn" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\web\villagecirc\htdocs\_database\bt.mdb"/>
     
  6. thank you that fixed my webconfig file error. Now I will have to see about these other two errors within my C# aplication


    C:\Documents and Settings\smpaulson\VSWebCache\www.villagecircle.net\Test\Test.aspx.cs(31): The type or namespace name '[^]' could not be found (are you missing a using directive or an assembly reference?)

    C:\Documents and Settings\smpaulson\VSWebCache\www.villagecircle.net\Test\Test.aspx.cs(58): The type or namespace name 'ConfigurationSettings' could not be found (are you missing a using directive or an assembly reference?)

    I have absolutely no idea what 'FrosCommBL' is nor if it derives from a certain using statement?


    Matthew H. Paulson
    [email protected]
    http://www.villagecircle.net
     
  7. I am down to one error now as I was able to add the using system.configuration using statement now I am scratching my head about the and[?] have absolutely no idea what 'FrosCommBL' is nor if it derives from a certain using statement?


    Matthew H. Paulson
    [email protected]
    http://www.villagecircle.net
     
  8. Hello Matthew,

    you need both of the following declarations

     
  9. I was able to get the code error free when I tried to create a dataset useing the method code listed above in the previous posts

    I created the new dataset by calling the predefined method ReturnDataset
    DataSet MYDS = ReturnDataset("SELECT * FROM Events");

    Allthough the code was bug free and seemed to work well I get an error when I view it in my browser....
    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:


    [InvalidOperationException: The ConnectionString property has not been initialized.]
    System.Data.OleDb.OleDbConnection.Open() +203
    Test.Test.ReturnDataset(String cmdText) in c:\documents and settings\smpaulson\vswebcache\www.villagecircle.net\test\test.aspx.cs:39
    Test.Test.Page_Load(Object sender, EventArgs e) in c:\documents and settings\smpaulson\vswebcache\www.villagecircle.net\test\test.aspx.cs:28
    System.Web.UI.Control.OnLoad(EventArgs e) +67
    System.Web.UI.Control.LoadRecursive() +35
    System.Web.UI.Page.ProcessRequestMain() +731


    I am at a loss and just when I thought I had it going I seem even further than I started if anyone has any idea what I have done wrong or any other suggestions in the matter it would be greatly apreciated....

    Matthew H. Paulson
    [email protected]
    http://www.villagecircle.net
     
  10. I can tell you what the FrosCommBL is ... it is one of my namespaces [:I]. I probably didn't clean it up when posting some example code (you should have deleted the striked part) ... sorry it took so long to respond.

     
  11. I was finally able to get the dataset bound to a datagrid and I wanted to thank everyone for takeing the time to respond to my error messages. The first time doing something is always like pulling teeth to me but preseverence is the key ...

    I had one more question are we able to update the data base using update commands delete commands and insert commands and so on?????

    Matthew H. Paulson
    [email protected]
    http://www.villagecircle.net



    Matthew H. Paulson
    [email protected]
    http://www.villagecircle.net
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page