Problems with DataSets!
Posted by: Wayne Gibson
Date: December 05, 2004 07:31AM

Hi,
Was wondering if anybody could help.

I've just installed the MySQL .NET Connector and try retrieve data from it..
I have been using the following code, but everytime the dataset is empty :(

using System.Data;

string strDatabaseLocation = ConfigurationSettings.AppSettings["DataConnection"];
DataConnection = new MySql.Data.MySqlClient.MySqlConnection();
DataConnection.ConnectionString = strDatabaseLocation;
DataConnection.Open();

string SQLQuery = "SELECT UserID, Forename, Surname, Password FROM users";

MySql.Data.MySqlClient.MySqlDataAdapter DataAdapter = new MySql.Data.MySqlClient.MySqlDataAdapter();
DataAdapter.SelectCommand = new MySql.Data.MySqlClient.MySqlCommand(SQLQuery, DataConnection);

DataAdapter.Fill(UserInfo);
// At this point UserInfo is empty, it has no records!!

// So I tried the following
DataTable data = new DataTable();
DataAdapter.Fill( data );
// data contains the rows of data!!

Wasn't sure if it was anything to do with my Dataset that I have created..

//// Dataset Start
<?xml version="1.0" standalone="yes" ?>
<xs:schema id="dsLogonUserInfo" targetNamespace="http://www.tempuri.org/dsLogonUserInfo.xsd";
xmlns:mstns="http://www.tempuri.org/dsLogonUserInfo.xsd"; xmlns="http://www.tempuri.org/dsLogonUserInfo.xsd";
xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:element name="dsLogonUserInfo" msdata:IsDataSet="true" msdata:Locale="en-GB">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="users">
<xs:complexType>
<xs:sequence>
<xs:element name="UserID" msdata:AutoIncrement="true" type="xs:long" minOccurs="0" />
<xs:element name="Forename" type="xs:string" minOccurs="0" />
<xs:element name="Surname" type="xs:string" minOccurs="0" />
<xs:element name="Password" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:unique name="Constraint1">
<xs:selector xpath=".//mstns:users" />
<xs:field xpath="mstns:UserID" />
</xs:unique>
</xs:element>
</xs:schema>
//// DataSet End

Any help would be extremely welcome..

Thanks

Wayne

Options: ReplyQuote


Subject
Written By
Posted
Problems with DataSets!
December 05, 2004 07:31AM
December 07, 2004 01:42PM
December 12, 2004 09:32AM
December 21, 2004 11:29AM
January 11, 2005 03:17AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.