Can I use Partial class to enhance a typed dataset without losing the custom code?

Hi All,
I wanted to see if I could use a Partial class for one of the datatable classes to add custom code so that when the dataset is regenerated I don't lose my code.
Partial public
Class
WA_MMTP_TrackerDataSet1
 'Code for dataset
 Partial Public Class PATIENTSTableAdapter
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Fill, true)>  _
        Public Overloads Overridable Function FillbyClinicianId(ByVal dataTable As WA_MMTP_TrackerDataSet1.PATIENTSDataTable, ClinicianId As Integer, sql As string) As Integer
             Dim dd As System.Data.SqlClient.SqlCommand
            dd = new System.Data.SqlClient.SqlCommand
            dd.CommandText = Sql
            dd.Connection = OpenConnection() '  UsersTableAdapter1.Connection
            Me.Adapter.SelectCommand = dd 'Me.CommandCollection(0)
            If (Me.ClearBeforeFill = true) Then
                dataTable.Clear
            End If
            Dim returnValue As Integer = Me.Adapter.Fill(dataTable)
            Return returnValue
        End Function
'Other code for datatable
end class
end class
I'd like to take the function FillbyClinicianId and put it in a separate partial class like so and remove the function by the same name from the original file (dataset file):
Partial Public Class PATIENTSTableAdapter
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Fill, true)>  _
        Public Overloads Overridable Function FillbyClinicianId(ByVal dataTable As WA_MMTP_TrackerDataSet1.PATIENTSDataTable, ClinicianId As Integer, sql As string) As Integer
             Dim dd As System.Data.SqlClient.SqlCommand
            dd = new System.Data.SqlClient.SqlCommand
            dd.CommandText = Sql
            dd.Connection = OpenConnection() '  UsersTableAdapter1.Connection
            Me.Adapter.SelectCommand = dd 'Me.CommandCollection(0)
            If (Me.ClearBeforeFill = true) Then
                dataTable.Clear
            End If
            Dim returnValue As Integer = Me.Adapter.Fill(dataTable)
            Return returnValue
        End Function
end class
But when I try this, the compiler gives the following errors:
Error 91 'Adapter' is not a member of 'AttendTrackerFull.WA_MMTP_TrackerDataSet1.PATIENTSTableAdapter'. 
Error 92 'ClearBeforeFill' is not a member of 'AttendTrackerFull.WA_MMTP_TrackerDataSet1.PATIENTSTableAdapter'. 
I guess I'm a little confused. once code is moved into the custom partial class it seems to lose any knowledge of the main class file and any references in the class. Am I doing it wrong? or is it a restriction of the .Net since it is in another
file. If its because its in another file, my next question would it be better to take the partial class I created to contain my custom code, should I just move my partial class to the bottom of the dataset.designer.vb file? But if I do this, wont it still
erase my custom code. Any suggestions?
Thanks
Michael

Thanks for the reply.
They are compile time errors, but the error shows up even before compiling, so I guess it would be designer time exception also.
What I did the other day was to create a new class file (didn't add a namespace statement to class) then added the code in prev message. This morning I added a new module and added the prev code in it incased in the namespace
namespace ADO.NET.DataSet1TableAdapters statement. But I still have the same errors messages. I tried
to set the Custom tool.namespace property of the dataset to WA_MMTPDataset and then did the following in a module:
namespace WA_MMTPDataset
Module Module4
Partial Public Class PATIENTSTableAdapter
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"), _
Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Fill, true)> _
Public Overloads Overridable Function FillbyClinicianId(ByVal dataTable As WA_MMTP_TrackerDataSet1.PATIENTSDataTable, ClinicianId As Integer, sql As string) As Integer
Dim dd As System.Data.SqlClient.SqlCommand
dd = new System.Data.SqlClient.SqlCommand
dd.CommandText = Sql
dd.Connection = OpenConnection() ' UsersTableAdapter1.Connection
Me.Adapter.SelectCommand = dd 'Me.CommandCollection(0)
If (Me.ClearBeforeFill = true) Then
dataTable.Clear
End If
Dim returnValue As Integer = Me.Adapter.Fill(dataTable)
Return returnValue
End Function
End Class
Partial Public Class UsersTableAdapter
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"), _
Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Fill, true)> _
Public Overloads Overridable Function FillbyClinicianId(ByVal dataTable As WA_MMTP_TrackerDataSet1.UsersDataTable, ClinicianId As Integer, sql As string) As Integer
Dim dd3 As System.Data.SqlClient.SqlCommand
dd3 = new System.Data.SqlClient.SqlCommand
dd3.CommandText = Sql
dd3.Connection = OpenConnection()
Me.Adapter.SelectCommand = dd3 'Me.CommandCollection(0)
If (Me.ClearBeforeFill = true) Then
dataTable.Clear
End If
Dim returnValue As Integer = Me.Adapter.Fill(dataTable)
Return returnValue
End Function
End Class
End Module
End Namespace
But I'm still getting the same errors.

Similar Messages

  • Can you use a start up disc on an iMac without formatting the hard drive?

    Can you use a start up disc on an iMac without formatting the hard drive?

    Yes, because the startup disk is read from the boot rom, not the Hard Disk.

  • How can I sync my iphone songs to a new library without losing the songs on my iphone. I no longer have access to the old library as it was on a company computer that I no longer work for.

    how can I sync my iphone songs to a new library without losing the songs on my iphone. I no longer have access to the old library as it was on a company computer that I no longer work for.

    Third Party software do a google search

  • Can I move an IPad to a new iTunes account without losing the apps?

    I currently have two devices on my itunes account, and would like to move one the devices to a new itunes account (not mine). Is it possible to do this without losing all of the apps that have been acquired on that device?

    You can only have one library per user account on a PC/Mac.
    So, if you need to create a new library, then create a new user, and transfer the content you want over to that new user. Then sync.
    Can you clarify a little more what you're needing?

  • Can I use iphone 5 as a camera and ipod without activating the phone service

    Can I buy a new Iphone 5 and use as a camera and Ipod, wtihout activating the phone?

    Yes, you can. There still needs to be a SIM card in the phone if the phone hasn't been set up yet; the SIM does not have to be active.

  • How can i convert a numbers file into an excel file, without losing the pictures that i used in the numbers file?

    Hi,
    i made a numbers file which includes pictures, which i put in by drag and drop. But when i convert the file in excel, the pictures dissappear. Does anyone have a hint for me?
    Thanks!

    Numbers supports pictures as objects added to a sheet, and as images used as background fill.
    Excel does not support "sheets" as defined in Numbers, nor does it support 'image fill' in cells.
    If your use requires excel, and requires pictures, you may need to use Excel, or one of the open source substitutes for Excel, OpenOffice.org, LibreOffice, or NeoOffice.
    Regards,
    Barry

  • If i have downloaded ( different ) apps in two iphones how can i add new apps in either of them without losing the older ones?

    i have two iphones 3g one at 4.1 and other at 3.1.3.....i have downloaded through itunes 30 apps in one and 55 different apps in other .......now how can i add 10 more apps in either of them without losing the previous apps .....if i don't have the previous apps downloaded now in my laptop..................?

    You can download the Apps on other devices by logging into the App Store with the ID you downloaded the App with

  • Can i sync my iphone with a new personal computer without losing apps, music,photos and other objects

    Can I sync my iphone with a new personal computer without losing the content of the phone, apps, music, photos.....

    See Here for
    Transfer from Old  to New
    http://pondini.org/OSX/Setup.html
    See Here for
    iTunes: How to move your music to a new computer
    Or...
    From your Old Computer... Copy your ENTIRE iTunes FOLDER to an External Drive... and then from the External Drive to your New Computer..
    An Added Bonus is that you will then have a Backup of iTunes...
    Backup iTunes to an External Drive
    http://support.apple.com/kb/HT1751

  • Can i Use java Class

    Can any help, can i use java class in
    froms 6 or any one have designed form
    of progress bar please help me

    Thanks for your reply...
    Actually the task is quite simple... It requires me to do a better interface for a tomcat server folders...
    For example, users are free to access
    http://apache.oss.eznetsols.org/jakarta/tomcat-5/v5.0.12-beta/
    to download the tomcat... However, its index may not nice and easy for browing.. Therefore, the task requires a new dynamic page to access this server folder, and get all file names under this folder, anlaysis whether it is file or directory..and finally get its path....
    It is quite easy to do a JSP page, but I don't know whether it is possible to do by using JavaScript .... Although JS is running in client side, the user/client also can access the tomcat folder, why not JavaScript?
    Thanks a lot!
    SD

  • Can i use partial page rendering with BC4J?

    Hi!
    I can't use partial page rendering when i use table for bc4j...
    Why is it?
    Viktor

    Why do you say that? It seems to work fine for me...

  • I can't use Math.class

    I can't use Math.class although I import java.lang.*.
    plz help me.

    and tell us what you mean by "can't use"My father began to work a PC as he was already
    retired. He has been fighting with it ever since.
    Sometimes he calls me for help crying "everthying has
    disappeared!"
    I ask him: "What is 'everything' and what does it
    mean 'disappeared'?"you could then go on to throw a further spanner in the works by asking what "has" means :)

  • HT1589 Can I use more than 1 device ie iPod and iPhone on the same iTunes account and have different music on them

    Can I use more than 1 device ie iPod and iPhone on the same iTunes account and have different music on them

    Yes. Use the option to sync with selected playlists on the music tab when your devices are connected.
    tt2

  • Can I use iTunes 10.7 and iTunes 11.1.3 on the same computer running Windows 7?

    Can I use iTunes 10.7 and iTunes 11.1.3 on the same computer running Windows 7 (64-bit)?

    Yes, but it needs to have at least two copies of Windows installed.
    (94491)

  • Can I use an radar alarm on my iphone 4, without passing by the telephone card, for example in plane mode?

    Can I use an radar alarm on my iphone 4, without passing by the telephone card, for example in plane mode? This question in order to avoid the roaming when I leave my country for a foreigner one

        Hi there Eartley! That sounds like an amazing opportunity for you! I am glad you are going to be able to study in Italy. The iPhone 6 is an excellent phone to travel with and you should have no problems using a local SIM card while you are in Italy. While I have not been to Italy myself and can not make recommendations for service providers out there, our Global Support Team may be able to help out! Here is where you can get in touch with them http://vz.to/1DgQ1IJ . Have a great trip!
    bryans_vzw
    Follow us at Twitter @vzwsupport

  • I still have 5 Gb icloud storage but 2.1 gb on iphone I want to upgrade to 6.0 but need 2.6 gb on my phone can i use icloud to free up some space and still access the apps that I store there on my iphone

    i still have 5 Gb icloud storage but 2.1 gb on iphone I want to upgrade to 6.0 but need 2.6 gb on my phone can i use icloud to free up some space and still access the apps that I store there on my iphone.

    No.
    You need to delete content from your iphone.

Maybe you are looking for

  • Code appearing on bottom of web pages

    I am in the process of releasing my web site and code like this is appearing on the bottom of all my pages. How do I get rid of it. Thanks Cyndee -----------------------------130683370316387884521639739989 Content-Disposition: form-data; name="userfi

  • Commit/Rollback Buttons Diabled for Pinned Tables?

    When I pin a table, the commit/rollback buttons become disabled. Is there a reason for that, or is it a bug? Java(TM) Platform     1.5.0_12 Oracle IDE     1.5.0.52.03

  • Batch mangement-IS  Retail

    Hi I need to where we can specify the batch management classification values for the article  MM41 in SAP IS retail ,I could not  see the clasification tab page as in MM01.

  • Magic Move not scaling text

    Hi - despite assurances from the manual and the help files, I cannot get Magic Move to scale and move a text box - it just dissolves instead. This from a single slide with nothing else on it, duplicated and then the text moved and resized. Any ideas?

  • HT1212 iphone has completly locked up

    hello, my iphone 4 has locked up on lock screen, cant answer calls or turn it off, cant do anything on it, i tried to take a photo, the phone asked to cancel or delete?, but then it just locked up!, please help me, i cant answer my phone so you call