| | |
DropdownList DataBinding
Please support our ASP.NET advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Mar 2008
Posts: 324
Reputation:
Solved Threads: 7
ASP.NET Syntax (Toggle Plain Text)
<connectionStrings> <add name="ConnectionString" connectionString="Data Source=(local);Initial catalog=sonia;User ID=sonia;Password=sonia;" providerName="System.Data.SqlClient"/> </connectionStrings>
ASP.NET Syntax (Toggle Plain Text)
public partial class Frmgrid : System.Web.UI.Page { SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString); SqlDataAdapter da; DataSet ds; protected void Page_Load(object sender, EventArgs e) { try { da = new SqlDataAdapter("SELECT * FROM Products", conn); da.Fill(ds, "tb1"); DropDownList1.DataSource = ds.Tables["tb1"]; DropDownList1.DataBind(); } catch (Exception ex) { Response.Write(ex.Message.ToString()); } } }
ERROR is dere while executing the line da.Fill(ds, "tb1");
"Value cannot be null.\r\nParameter name: dataSet"
Last edited by sonia sardana; Oct 23rd, 2009 at 1:40 pm.
•
•
Join Date: Jul 2008
Posts: 44
Reputation:
Solved Threads: 6
0
#2 Oct 23rd, 2009
You must intialize ds
e.g. DataSet ds = new DataSet();
Check this eg:
http://msdn.microsoft.com/en-us/libr...8z(VS.80).aspx
e.g. DataSet ds = new DataSet();
Check this eg:
http://msdn.microsoft.com/en-us/libr...8z(VS.80).aspx
![]() |
Similar Threads
- Fill Drodownlist By changing value in another dropdownlist (ASP.NET)
- GetSelectedIndex Datagrid? Dropdownlist (ASP.NET)
- DropDownList headache (ASP.NET)
- Help with Databinding (ASP.NET)
- DataGrid: Edit mode, the index of a dropdownlist does not start at the right Value (ASP.NET)
- GetSelectedIndex Datagrid? Dropdownlist (C#)
- How do I save an index to a particular index of a dropdownlist in a datagrid. (C#)
- Help With Datagrid RE: Creating and Saving DropDownList ReportsToID (C#)
Other Threads in the ASP.NET Forum
- Previous Thread: Problem With Dropdowns, Loops, Databinding and Placeholders
- Next Thread: Inserting .swf file
Views: 405 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for ASP.NET
.net 2.0 3.5 activexcontrol advice ajax application asp asp.net bc30451 bottomasp.net browser businesslogiclayer button c# c#gridviewcolumn checkbox child class click compatible confirmationcodegeneration content contenttype countryselector courier css database datagrid datagridview datagridviewcheckbox datalist deadlock development dgv dropdown dropdownmenu edit feedback flash flv folder form forms google grid gridview homeedition hosting identity iframe iis index javascript jquery list maps menu mono mssql multistepregistration nameisnotdeclared object objects order problem profile ratings refer rotatepage save search security serializesmo.table session silverlight smartcard software sql suse textbox tracking typeof unauthorized update validation vb vb.net video view virtualdirectory vista visual-studio visualstudio vs2008 web webarchitecture webdevelopemnt wizard xml





