MySQL DAL question

Last post 05-16-2008 9:57 AM by green_bean. 5 replies.

Sort Posts:

  • MySQL DAL question

    05-13-2008, 1:10 PM
    • Loading...
    • green_bean
    • Joined on 05-13-2008, 10:45 AM
    • Posts 5
    Please forgive me if this has already been asked. Following this article http://www.asp.net/learn/data-access/tutorial-01-cs.aspx, I've got my DAL created for my MySQL database, however, I'm not sure how to access my newly created data adapter class (in the article, this is the example below figure 12).

    The article uses 'using NorthwindTableAdapters;' and then the 'ProductsTableAdapter' class. I've tried 'using MySql.data.MySqlClient;' but cannot access my class. I know for certain that the MySQL.Data.dll is installed and registered in the GAC (otherwise why would I be able to connect to and create my DAL). What namespace am I suppose to use in my code page to be able to access my DAL? Would I even need specify a namespace? The answer is probably very simple, but I'm so confused and frustrated...

    My DAL is called MyTestDAL and my data table is MyTestDB. Would my dataadapter class then be MyTestDAL.MyTestDBTableAdapter?

    I'm using Visual Studio 2008 and the latest version of mySQL and Connector/Net 5.2.
    Filed under:
  • Re: MySQL DAL question

    05-13-2008, 3:05 PM
    • Loading...
    • green_bean
    • Joined on 05-13-2008, 10:45 AM
    • Posts 5
    Anybody?
  • Re: MySQL DAL question

    05-16-2008, 1:30 AM
    Answer

    Hi Green_bean,

    As default, you can use MyTestDALTableAdapters.MyTestDBTableAdapter to access the table.

    BTW, you can try to enter MyTestDAL to get the help of VS2008 intelligent sense help. Please take a try and hope this helps you!

     

    Thanks.

    Sincerely,
    JanIvan Qian

    Please remember to click “Mark as Answer” on the post that helps you. This can be beneficial to other community members reading the thread.
  • Re: MySQL DAL question

    05-16-2008, 2:36 AM
    Answer
    • Loading...
    • ShivaKarthik
    • Joined on 04-15-2008, 9:11 AM
    • Hyderabad
    • Posts 196

    Hi Buddy,

    Please follow the following steps let me know if this helps you

    when you create a dataset you should import the following namesapce as such for example the dataset is karthik.XSD("This is a wizard")

    you should import the namespace as

    using karthikTableAdapters;

    and for your table adapter use the following

    the tableadaptername will be the name of your table in the sense for example the tableadapter name is some X

    you define  in this way

    XTableAdapter microsoftforums=new XTableAdapter;

    now you define in this way

    microsoftforums.(ur methods that is it may be the name of your insertquery,updatequery or which return rows whatever it may be)

     

    Mark As Answer if this helps you

    Further Queries Recommended

    Happy CodingWink

     

    Regards,
    B.ShivaKarthik
    Software Engineer
    Hyderabad,India
  • Re: MySQL DAL question

    05-16-2008, 5:12 AM
    Answer
    • Loading...
    • LockH
    • Joined on 03-25-2007, 2:58 PM
    • Scotland, where whisky has no e.
    • Posts 542

    green_bean:

    My DAL is called MyTestDAL and my data table is MyTestDB. Would my dataadapter class then be MyTestDAL.MyTestDBTableAdapter

     

    If I understand you right, your XSD file in the App_Code folder is called MyTestDAL.XSD and your MySQL database table - the table, not the database - is called MyTestDB?

     

    In which case

    NorthwindTableAdapters.ProductsTableAdapter productsAdapter = new NorthwindTableAdapters.ProductsTableAdapter();   

    Northwind.ProductsDataTable products;

     becomes

    MyTestDALTableAdapters.MyTestDBTableAdapter myTestDBAdapter = new MyTestDALTableAdapters.MyTestDBTableAdapter();

    MyTestDAL.MyTestDBDataTable myTestDB;

     

     

     

     

    So what is the .xsd file in the App_Code called?

    If it is called "foo.xsd" then your BLL code should include :-

    using FooTableAdapters;    // note Adapters with an s on the end, not Adapter.

     

    Here is an example where xsd file is Foo.xsd,  my database table is named EntryClasses, my source file could be called anything but it is EntryClassesBLL.cs ...

     

    using System;

    using lots of other stuff ...

    using FooTableAdapters;    // note Adapters with an s on the end, not just Adapter.

    [System.ComponentModel.DataObject]

    public class EntryClassesBLL

    {

    private EntryClassesTableAdapter _entryClassesAdapter = null;protected EntryClassesTableAdapter Adapter

    {

    get

    {

    if (_entryClassesAdapter == null)

    _entryClassesAdapter = new EntryClassesTableAdapter();

    return _entryClassesAdapter;

    }

    }

    If a post helps to solve your problem, please click the Answer button on that post.

    I'm still confused, but now I'm confused on a higher plane.
  • Re: MySQL DAL question

    05-16-2008, 9:57 AM
    Answer
    • Loading...
    • green_bean
    • Joined on 05-13-2008, 10:45 AM
    • Posts 5
    Thanks everyone! I was able to understand how to work with the DAL with the examples you guys gave. I think I'm going to like this forum. :-).
Page 1 of 1 (6 items)