[dba-VB] C# Help with binding components

Gustav Brock Gustav at cactus.dk
Mon Mar 29 02:21:13 CDT 2010


Hi John

That is a method created by VS when you add a custom select query to a DataTable in the designer (right-click at the bottom of the box holding the table). 
As one of the last steps, the wizard offers to create two methods, GetData() and Fill(), which you can rename, and this I do to reflect what the query - and thus the method - does.
It is all stored in the xsd file of the dataset as this snip of the XML shows:

            <Sources>
              <DbSource ConnectionRef="KarneliaConnectionString (Settings)" DbObjectName="KARNELIA.dbo.CustomerEmail" DbObjectType="Table" FillMethodModifier="Public" FillMethodName="FillByCustomerId" GenerateMethods="Both" GenerateShortCommands="true" GeneratorGetMethodName="GetDataByCustomerId" GeneratorSourceName="FillByCustomerId" GetMethodModifier="Public" GetMethodName="GetDataByCustomerId" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetDataByCustomerId" UserSourceName="FillByCustomerId">
                <SelectCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="true">
                    <CommandText>SELECT CustomerId, EmailAddress, EmailAddressType, Id, Inactive, Name FROM CustomerEmail WHERE (CustomerId = @CustomerId) ORDER BY Name</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="false" AutogeneratedName="CustomerId" ColumnName="CustomerId" DataSourceName="KARNELIA.dbo.CustomerEmail" DataTypeServer="int" DbType="Int32" Direction="Input" ParameterName="@CustomerId" Precision="0" ProviderType="Int" Scale="0" Size="4" SourceColumn="CustomerId" SourceColumnNullMapping="false" SourceVersion="Current" />
                    </Parameters>
                  </DbCommand>
                </SelectCommand>
              </DbSource>
            </Sources>

/gustav


>>> jwcolby at colbyconsulting.com 29-03-2010 04:31 >>>
Gustav,

How is the .FillByCustomerID method created?  This is in fact my "missing piece".

 >         private void FillCustomerEmailAddress()
 >         {
 >             this.customerEmailTableAdapter.FillByCustomerId(this.karnelia.CustomerEmail, 
_customerId);
 >         }


John W. Colby
www.ColbyConsulting.com 






More information about the dba-VB mailing list