Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Custom Controls and Properties
Message
 
To
31/10/2002 14:56:52
Jim Rieck
Quicken Loans/Rock Financial/Title Sourc
Livonia, Michigan, United States
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00717518
Message ID:
00717557
Views:
17
If your DataTable inside your DataSet is not getting populated, I would recommend tracing your code in the debugger. Have you tried executing your Store Procedure? My thinking is that the parameters are not getting set as you expected.

>All,
>
> I have a custom search control with a property that is a dataset. The control also has a label, a textbox, a button for searching and a requirefield control. When I click the search button data is retrieved and the dataset property is filled. I want to be able to access the dataset from a webform, but for some reason the dataset is empty and I'm not understanding why. I've included the code for the search button and the property declaration. Am I doing something wrong? Is there a better way to do this? Any suggestions or feedback would be appreciated.
>
>
>System.Data.DataSet dssearch = new DataSet();
>[Bindable(true),
>Category("Data"),
>DefaultValue("")]
>public System.Data.DataSet dsSearch
>  {
>    get
>     {
>	this.EnsureChildControls();
>	return dssearch;
>     }
>     set
>	{
>	  this.EnsureChildControls();
>	  dssearch = value;
>	}
>  }		
>
>
>
>void cmdSearchClicked(System.Object sender, System.EventArgs e)
>{		
>  this.oConSearch.ConnectionString = this.connectionstring;
>  this.oConSearch.Open();
>  SqlDataAdapter oDaCustomer = new SqlDataAdapter(this.SearchProcedure,this.oConSearch);
>  oDaCustomer.SelectCommand.CommandType = CommandType.StoredProcedure;
>  oDaCustomer.SelectCommand.CommandText = this.searchproc;
>  if (this.paramname.Trim().Length > 0)
>    {				
>	this.lblMessage.Visible = true;
>	oDaCustomer.SelectCommand.Parameters.Add(this.paramname,System.Data.SqlDbType.VarChar,this.paramsize);
>	oDaCustomer.SelectCommand.Parameters[this.paramname].Value = this.txtSearch.Text;
>	this.dssearch.Clear();
>	oDaCustomer.Fill(this.dssearch);
>	this.oConSearch.Close();
>	this.lblMessage.Text = this.txtSearch.Text + " " + oDaCustomer.SelectCommand.CommandText + " " + this.dssearch.Tables[0].Rows.Count.ToString();
>	if (this.dssearch.Tables.Count > 0)
>	  {
>	    this.RecordCount = this.dssearch.Tables[0].Rows.Count;
>	  }				
>	}
>}
>
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform