开发者

SQLdatasource select put into text box

开发者 https://www.devze.com 2023-02-15 04:01 出处:网络
I am trying to populate a text box from a sqldarasource but I keep getting \"Object reference not set to instance of an object\". Anyone have a clue what im doing wrong? My select statement that I\'ve

I am trying to populate a text box from a sqldarasource but I keep getting "Object reference not set to instance of an object". Anyone have a clue what im doing wrong? My select statement that I've configured works fine. Here is the code I'm using.

FNTextbox.Text = sqlmedia.SelectParameters["CFN"].ToString();

sqlmedia is a sqldatasource that grabs data from a stored procedure simple statement. i created this using the visual studio toolbox. I do init开发者_StackOverflow中文版ialize earlier in my pageload.


Sounds like you havent instantiated sqlmedia. In your code somewhere you have to create an instance of this class e.g.

sqlmedia = new SqlDataSource();


I think you need to set the "CFN" parameter first:

sqlmedia.SelectParameters.Item("CFN").DefaultValue = value;

0

精彩评论

暂无评论...
验证码 换一张
取 消