Solved

using strongly typed datasets with textboxes

Posted on 2009-04-11
16
387 Views
Last Modified: 2013-11-26
Hi, i have a strongly typed dataset and would like to use the data with textboxes in a web application. how do i get the data from the dataset into the textboxes?
I am using visual studio 2008 and asp.net (visual basic)

thanks
Mick
0
Comment
Question by:Mick_Buckley
  • 8
  • 8
16 Comments
 
LVL 10

Expert Comment

by:Espavo
ID: 24123258
Is this what you're asking for?
(I run this on Page_Load... )

            If Not IsPostBack Then
                Dim CatAdaptor As New SQLDataSetTableAdapters.CatalogueTableAdapter
                Dim cItems As SQLDataSet.CatalogueDataTable = CatAdaptor.GetItem(Request.QueryString("cID"))
                If cItems.Rows.Count > 0 Then
                    Dim cItem As SQLDataSet.CatalogueRow = cItems.Rows(0)
                    cWidthTextBox.Text = cItem.cWidth
                    cLengthTextBox.Text = cItem.cLength
                    cSquareTextBox.Text = cItem.cSquare
                    cDepthTextBox.Text = cItem.cDepth
                    cHeightTextBox.Text = cItem.cHeight
                End If
            End If

Open in new window

0
 

Author Comment

by:Mick_Buckley
ID: 24123630
when i type SqlDatasettableadapter.SiteTableAdapter it is underlined in blue and says it is not defined.
what could cause this?

Thanks
Mick
0
 
LVL 10

Expert Comment

by:Espavo
ID: 24124661
SqlDatasettableadapter. is the name of MY DataSet...

(I use a single DataSet and I add all my DataTables to the one DataSet for ease of use...)
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

Author Comment

by:Mick_Buckley
ID: 24124797
thanks for the reply,
what i've got at the moment is an xsd file (Site.xsd) and a class file Site.vb i've attached the class file.
i can use this with a grid view no problems with the following code
 Dim objSite As New SiteBLL()
        gvSite.DataSource = objSite.GetData()
        gvSite.DataBind()
that works fine, what i would like to do is use the same datasource for a form contailning textboxes.
what i've got so far from your code is:

Dim CatAdapter As New SiteTableAdapter
        Dim citems = CatAdapter.GetDataBySiteID(57)
        If citems.Rows.Count > 0 Then
            txtSiteName.Text = citems.SiteNameColumn.ToString()
            txtAddress1.Text = citems.Address1Column.ToString()
            txtAddress2.Text = citems.Address2Column.ToString()
            txtAddress3.Text = citems.Address3Column.ToString()
        End If
but that just gives me the column names in the text boxes, where am i going wrong

Thanks
Mick

Imports Microsoft.VisualBasic
Imports SiteTableAdapters
 
 
<System.ComponentModel.DataObject()> Public Class SiteBLL
 
    Private _SiteAdapter As SiteTableAdapter
    Protected ReadOnly Property Adapter() As SiteTableAdapter
        Get
            If _SiteAdapter Is Nothing Then
                _SiteAdapter = New SiteTableAdapter
            End If
            Return _SiteAdapter
        End Get
    End Property
 
    <System.ComponentModel.DataObjectMethodAttribute(ComponentModel.DataObjectMethodType.Select, True)> _
    Public Function GetData() As Site.SiteDataTable
        Return Adapter.GetData()
    End Function
 
    <System.ComponentModel.DataObjectMethodAttribute(ComponentModel.DataObjectMethodType.Select, False)> _
    Public Function GetDataBySiteID(ByVal SiteID As Int32) As Site.SiteDataTable
        Return Adapter.GetDataBySiteID(SiteID)
    End Function
 
End Class

Open in new window

0
 
LVL 10

Expert Comment

by:Espavo
ID: 24125134
You've missed the line of code that GETS the data:
                   Dim cItem As SQLDataSet.CatalogueRow = cItems.Rows(0)

0
 

Author Comment

by:Mick_Buckley
ID: 24125256
it doesn't recognise SQLDataSet.CatalogueRow (underlined in Blue)
Do i need to import or declare anything to use this

Mick
0
 
LVL 10

Expert Comment

by:Espavo
ID: 24125386
I'm a bit confused as to the way that you are calling the data from the vb class... (And all I did was copied the line from my code to show you what was missing...
Try substituting SQLDataSet. with SiteDataSet. and see what you get...
0
 

Author Comment

by:Mick_Buckley
ID: 24125496
I get the same using SiteDataSet. I've attached the class file i'm using (Site.vb)
if i use this with a gridview and use the following code it works fine
 Dim objSite As New SiteBLL()
        gvSite.DataSource = objSite.GetData()
        gvSite.DataBind()
any ideas?
Imports Microsoft.VisualBasic
Imports SiteTableAdapters
 
 
<System.ComponentModel.DataObject()> Public Class SiteBLL
 
    Private _SiteAdapter As SiteTableAdapter
    Protected ReadOnly Property Adapter() As SiteTableAdapter
        Get
            If _SiteAdapter Is Nothing Then
                _SiteAdapter = New SiteTableAdapter
            End If
            Return _SiteAdapter
        End Get
    End Property
 
    <System.ComponentModel.DataObjectMethodAttribute(ComponentModel.DataObjectMethodType.Select, True)> _
    Public Function GetData() As Site.SiteDataTable
        Return Adapter.GetData()
    End Function
 
    <System.ComponentModel.DataObjectMethodAttribute(ComponentModel.DataObjectMethodType.Select, False)> _
    Public Function GetDataBySiteID(ByVal SiteID As Int32) As Site.SiteDataTable
        Return Adapter.GetDataBySiteID(SiteID)
    End Function
 
End Class

Open in new window

0
 
LVL 10

Expert Comment

by:Espavo
ID: 24125852
The piece that seems to be missing is where you request the values from ONE ROW only...
You need to pull a DataSet... (As opposed to a DataTable)
0
 

Author Comment

by:Mick_Buckley
ID: 24125894
do you have any code to show me how this is done?
The function I call from the class does  only return a single row
Thanks
Mick
0
 
LVL 10

Expert Comment

by:Espavo
ID: 24126159
The code that I posted in the beginning of this discussion is all that I use...
I simply create my DataSet... then pull it as shown above... (no need to go through a second VB class... which is where I'm getting confused...)
0
 

Author Comment

by:Mick_Buckley
ID: 24126167
is your dataset an xsd file?
0
 
LVL 10

Expert Comment

by:Espavo
ID: 24126207
Yes...
0
 

Author Comment

by:Mick_Buckley
ID: 24126259
hi, thanks for you patience. I've attached the code for my xsd file, is there anything in here that you think may be giving me problems?
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="Site" targetNamespace="http://tempuri.org/Site.xsd" xmlns:mstns="http://tempuri.org/Site.xsd" xmlns="http://tempuri.org/Site.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop" attributeFormDefault="qualified" elementFormDefault="qualified">
  <xs:annotation>
    <xs:appinfo source="urn:schemas-microsoft-com:xml-msdatasource">
      <DataSource DefaultConnectionIndex="0" FunctionsComponentName="QueriesTableAdapter" Modifier="AutoLayout, AnsiClass, Class, Public" SchemaSerializationMode="IncludeSchema" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
        <Connections>
          <Connection AppSettingsObjectName="Web.config" AppSettingsPropertyName="MarketIntelligenceConnectionString2" ConnectionStringObject="" IsAppSettingsProperty="true" Modifier="Assembly" Name="MarketIntelligenceConnectionString2 (Web.config)" ParameterPrefix="@" PropertyReference="AppConfig.System.Configuration.ConfigurationManager.0.ConnectionStrings.MarketIntelligenceConnectionString2.ConnectionString" Provider="System.Data.SqlClient" />
        </Connections>
        <Tables>
          <TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="SiteTableAdapter" GeneratorDataComponentClassName="SiteTableAdapter" Name="Site" UserDataComponentName="SiteTableAdapter">
            <MainSource>
              <DbSource ConnectionRef="MarketIntelligenceConnectionString2 (Web.config)" DbObjectName="MarketIntelligence.dbo.Site" DbObjectType="Table" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="true" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="false" UserGetMethodName="GetData" UserSourceName="Fill">
                <DeleteCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="false">
                    <CommandText>DELETE FROM [dbo].[Site] WHERE (([SiteID] = @Original_SiteID))</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@Original_SiteID" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="SiteID" SourceColumnNullMapping="false" SourceVersion="Original" />
                    </Parameters>
                  </DbCommand>
                </DeleteCommand>
                <InsertCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="false">
                    <CommandText>INSERT INTO [dbo].[Site] ([fnAgencyID], [SiteName], [WebSite], [Google], [Address1], [Address2], [Address3], [Address4], [PostCode]) VALUES (@fnAgencyID, @SiteName, @WebSite, @Google, @Address1, @Address2, @Address3, @Address4, @PostCode)</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@fnAgencyID" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="fnAgencyID" SourceColumnNullMapping="false" SourceVersion="Current" />
                      <Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="AnsiString" Direction="Input" ParameterName="@SiteName" Precision="0" ProviderType="VarChar" Scale="0" Size="0" SourceColumn="SiteName" SourceColumnNullMapping="false" SourceVersion="Current" />
                      <Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="AnsiString" Direction="Input" ParameterName="@WebSite" Precision="0" ProviderType="VarChar" Scale="0" Size="0" SourceColumn="WebSite" SourceColumnNullMapping="false" SourceVersion="Current" />
                      <Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="AnsiString" Direction="Input" ParameterName="@Google" Precision="0" ProviderType="VarChar" Scale="0" Size="0" SourceColumn="Google" SourceColumnNullMapping="false" SourceVersion="Current" />
                      <Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="AnsiString" Direction="Input" ParameterName="@Address1" Precision="0" ProviderType="VarChar" Scale="0" Size="0" SourceColumn="Address1" SourceColumnNullMapping="false" SourceVersion="Current" />
                      <Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="AnsiString" Direction="Input" ParameterName="@Address2" Precision="0" ProviderType="VarChar" Scale="0" Size="0" SourceColumn="Address2" SourceColumnNullMapping="false" SourceVersion="Current" />
                      <Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="AnsiString" Direction="Input" ParameterName="@Address3" Precision="0" ProviderType="VarChar" Scale="0" Size="0" SourceColumn="Address3" SourceColumnNullMapping="false" SourceVersion="Current" />
                      <Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="AnsiString" Direction="Input" ParameterName="@Address4" Precision="0" ProviderType="VarChar" Scale="0" Size="0" SourceColumn="Address4" SourceColumnNullMapping="false" SourceVersion="Current" />
                      <Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="AnsiString" Direction="Input" ParameterName="@PostCode" Precision="0" ProviderType="VarChar" Scale="0" Size="0" SourceColumn="PostCode" SourceColumnNullMapping="false" SourceVersion="Current" />
                    </Parameters>
                  </DbCommand>
                </InsertCommand>
                <SelectCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="false">
                    <CommandText>SELECT SiteID, fnAgencyID, SiteName, WebSite, Google, Address1, Address2, Address3, Address4, PostCode FROM dbo.Site</CommandText>
                    <Parameters />
                  </DbCommand>
                </SelectCommand>
                <UpdateCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="false">
                    <CommandText>UPDATE [dbo].[Site] SET [fnAgencyID] = @fnAgencyID, [SiteName] = @SiteName, [WebSite] = @WebSite, [Google] = @Google, [Address1] = @Address1, [Address2] = @Address2, [Address3] = @Address3, [Address4] = @Address4, [PostCode] = @PostCode WHERE (([SiteID] = @Original_SiteID))</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@fnAgencyID" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="fnAgencyID" SourceColumnNullMapping="false" SourceVersion="Current" />
                      <Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="AnsiString" Direction="Input" ParameterName="@SiteName" Precision="0" ProviderType="VarChar" Scale="0" Size="0" SourceColumn="SiteName" SourceColumnNullMapping="false" SourceVersion="Current" />
                      <Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="AnsiString" Direction="Input" ParameterName="@WebSite" Precision="0" ProviderType="VarChar" Scale="0" Size="0" SourceColumn="WebSite" SourceColumnNullMapping="false" SourceVersion="Current" />
                      <Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="AnsiString" Direction="Input" ParameterName="@Google" Precision="0" ProviderType="VarChar" Scale="0" Size="0" SourceColumn="Google" SourceColumnNullMapping="false" SourceVersion="Current" />
                      <Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="AnsiString" Direction="Input" ParameterName="@Address1" Precision="0" ProviderType="VarChar" Scale="0" Size="0" SourceColumn="Address1" SourceColumnNullMapping="false" SourceVersion="Current" />
                      <Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="AnsiString" Direction="Input" ParameterName="@Address2" Precision="0" ProviderType="VarChar" Scale="0" Size="0" SourceColumn="Address2" SourceColumnNullMapping="false" SourceVersion="Current" />
                      <Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="AnsiString" Direction="Input" ParameterName="@Address3" Precision="0" ProviderType="VarChar" Scale="0" Size="0" SourceColumn="Address3" SourceColumnNullMapping="false" SourceVersion="Current" />
                      <Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="AnsiString" Direction="Input" ParameterName="@Address4" Precision="0" ProviderType="VarChar" Scale="0" Size="0" SourceColumn="Address4" SourceColumnNullMapping="false" SourceVersion="Current" />
                      <Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="AnsiString" Direction="Input" ParameterName="@PostCode" Precision="0" ProviderType="VarChar" Scale="0" Size="0" SourceColumn="PostCode" SourceColumnNullMapping="false" SourceVersion="Current" />
                      <Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@Original_SiteID" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="SiteID" SourceColumnNullMapping="false" SourceVersion="Original" />
                    </Parameters>
                  </DbCommand>
                </UpdateCommand>
              </DbSource>
            </MainSource>
            <Mappings>
              <Mapping SourceColumn="SiteID" DataSetColumn="SiteID" />
              <Mapping SourceColumn="fnAgencyID" DataSetColumn="fnAgencyID" />
              <Mapping SourceColumn="SiteName" DataSetColumn="SiteName" />
              <Mapping SourceColumn="WebSite" DataSetColumn="WebSite" />
              <Mapping SourceColumn="Google" DataSetColumn="Google" />
              <Mapping SourceColumn="Address1" DataSetColumn="Address1" />
              <Mapping SourceColumn="Address2" DataSetColumn="Address2" />
              <Mapping SourceColumn="Address3" DataSetColumn="Address3" />
              <Mapping SourceColumn="Address4" DataSetColumn="Address4" />
              <Mapping SourceColumn="PostCode" DataSetColumn="PostCode" />
            </Mappings>
            <Sources>
              <DbSource ConnectionRef="MarketIntelligenceConnectionString2 (Web.config)" DbObjectName="MarketIntelligence.dbo.Site" DbObjectType="Table" FillMethodModifier="Public" FillMethodName="FillBy" GenerateMethods="Both" GenerateShortCommands="true" GeneratorGetMethodName="GetDataBySiteID" GeneratorSourceName="FillBy" GetMethodModifier="Public" GetMethodName="GetDataBySiteID" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetDataBySiteID" UserSourceName="FillBy">
                <SelectCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="true">
                    <CommandText>SELECT SiteID, fnAgencyID, SiteName, WebSite, Google, Address1, Address2, Address3, Address4, PostCode FROM dbo.Site where SiteID = @SiteID</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="false" AutogeneratedName="SiteID" ColumnName="SiteID" DataSourceName="MarketIntelligence.dbo.Site" DataTypeServer="int" DbType="Int32" Direction="Input" ParameterName="@SiteID" Precision="0" ProviderType="Int" Scale="0" Size="4" SourceColumn="SiteID" SourceColumnNullMapping="false" SourceVersion="Current" />
                    </Parameters>
                  </DbCommand>
                </SelectCommand>
              </DbSource>
            </Sources>
          </TableAdapter>
        </Tables>
        <Sources />
      </DataSource>
    </xs:appinfo>
  </xs:annotation>
  <xs:element name="Site" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" msprop:Generator_UserDSName="Site" msprop:Generator_DataSetName="Site">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="Site" msprop:Generator_UserTableName="Site" msprop:Generator_RowDeletedName="SiteRowDeleted" msprop:Generator_TableClassName="SiteDataTable" msprop:Generator_RowChangedName="SiteRowChanged" msprop:Generator_RowClassName="SiteRow" msprop:Generator_RowChangingName="SiteRowChanging" msprop:Generator_RowEvArgName="SiteRowChangeEvent" msprop:Generator_RowEvHandlerName="SiteRowChangeEventHandler" msprop:Generator_TablePropName="_Site" msprop:Generator_TableVarName="tableSite" msprop:Generator_RowDeletingName="SiteRowDeleting">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="SiteID" msdata:ReadOnly="true" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" msprop:Generator_UserColumnName="SiteID" msprop:Generator_ColumnPropNameInRow="SiteID" msprop:Generator_ColumnVarNameInTable="columnSiteID" msprop:Generator_ColumnPropNameInTable="SiteIDColumn" type="xs:int" />
              <xs:element name="fnAgencyID" msprop:Generator_UserColumnName="fnAgencyID" msprop:Generator_ColumnPropNameInRow="fnAgencyID" msprop:Generator_ColumnVarNameInTable="columnfnAgencyID" msprop:Generator_ColumnPropNameInTable="fnAgencyIDColumn" type="xs:int" minOccurs="0" />
              <xs:element name="SiteName" msprop:Generator_UserColumnName="SiteName" msprop:Generator_ColumnPropNameInRow="SiteName" msprop:Generator_ColumnVarNameInTable="columnSiteName" msprop:Generator_ColumnPropNameInTable="SiteNameColumn" minOccurs="0">
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="50" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
              <xs:element name="WebSite" msprop:Generator_UserColumnName="WebSite" msprop:Generator_ColumnPropNameInRow="WebSite" msprop:Generator_ColumnVarNameInTable="columnWebSite" msprop:Generator_ColumnPropNameInTable="WebSiteColumn" minOccurs="0">
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="100" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
              <xs:element name="Google" msprop:Generator_UserColumnName="Google" msprop:Generator_ColumnPropNameInRow="Google" msprop:Generator_ColumnVarNameInTable="columnGoogle" msprop:Generator_ColumnPropNameInTable="GoogleColumn" minOccurs="0">
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="500" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
              <xs:element name="Address1" msprop:Generator_UserColumnName="Address1" msprop:Generator_ColumnPropNameInRow="Address1" msprop:Generator_ColumnVarNameInTable="columnAddress1" msprop:Generator_ColumnPropNameInTable="Address1Column" minOccurs="0">
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="50" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
              <xs:element name="Address2" msprop:Generator_UserColumnName="Address2" msprop:Generator_ColumnPropNameInRow="Address2" msprop:Generator_ColumnVarNameInTable="columnAddress2" msprop:Generator_ColumnPropNameInTable="Address2Column" minOccurs="0">
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="50" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
              <xs:element name="Address3" msprop:Generator_UserColumnName="Address3" msprop:Generator_ColumnPropNameInRow="Address3" msprop:Generator_ColumnVarNameInTable="columnAddress3" msprop:Generator_ColumnPropNameInTable="Address3Column" minOccurs="0">
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="50" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
              <xs:element name="Address4" msprop:Generator_UserColumnName="Address4" msprop:Generator_ColumnPropNameInRow="Address4" msprop:Generator_ColumnVarNameInTable="columnAddress4" msprop:Generator_ColumnPropNameInTable="Address4Column" minOccurs="0">
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="50" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
              <xs:element name="PostCode" msprop:Generator_UserColumnName="PostCode" msprop:Generator_ColumnPropNameInRow="PostCode" msprop:Generator_ColumnVarNameInTable="columnPostCode" msprop:Generator_ColumnPropNameInTable="PostCodeColumn" minOccurs="0">
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="10" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:choice>
    </xs:complexType>
    <xs:unique name="Constraint1" msdata:PrimaryKey="true">
      <xs:selector xpath=".//mstns:Site" />
      <xs:field xpath="mstns:SiteID" />
    </xs:unique>
  </xs:element>
</xs:schema>

Open in new window

0
 
LVL 10

Accepted Solution

by:
Espavo earned 250 total points
ID: 24126306
I just dropped your DataSet code into a new "site.xsd" file on my project...
And generated this code... please see if this works...

   Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            Dim SiteAdaptor As New SiteTableAdapters.SiteTableAdapter
            Dim Sites As Site.SiteDataTable = SiteAdaptor.GetDataBySiteID(57)
            If Sites.Rows.Count > 0 Then
                Dim Site As Site.SiteRow = Sites.Rows(0)
                txtSiteName.Text = Site.SiteName.ToString
                txtAddress1.Text = Site.Address1.ToString
                txtAddress2.Text = Site.Address2.ToString
                txtAddress3.Text = Site.Address3.ToString
            End If
        End If
    End Sub

Open in new window

0
 

Author Closing Comment

by:Mick_Buckley
ID: 31569219
Got it working in the end, i think i may have some issues with naming, i have a few items with the same name (different extensions)
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question