Object reference not set to an instance of an object
2007-08-01 09:12
621 查看
+ ex {"Object reference not set to an instance of an object."} System.Exception
Solution:
Dim command As New SqlCommand()
Dim hash As New Hashtable
SelectControl.Items.Clear()
Try
hash = ExecuteReader("PRZ3_GetTable", command)
Dim i As Int32
For i = 0 To hash.Count - 1 Step 1
SelectControl.Items.Add(CType(hash(i), ListItem))
Next
SelectControl.DataBind()
Catch ex As Exception
Response.Write(ex.Message)
End Try
因为我For i = 0 To hash.Count -1Step 1原来是For i = 0 To hash.Count Step 1,多了一项
索引是从开始的
Solution:
Dim command As New SqlCommand()
Dim hash As New Hashtable
SelectControl.Items.Clear()
Try
hash = ExecuteReader("PRZ3_GetTable", command)
Dim i As Int32
For i = 0 To hash.Count - 1 Step 1
SelectControl.Items.Add(CType(hash(i), ListItem))
Next
SelectControl.DataBind()
Catch ex As Exception
Response.Write(ex.Message)
End Try
因为我For i = 0 To hash.Count -1Step 1原来是For i = 0 To hash.Count Step 1,多了一项
索引是从开始的
相关文章推荐
- unity3D报NullReferenceException: Object reference not set to an instance of an object
- SQLite应用程序启动报错:Object reference not set to an instance of an object.
- WebAdaptor Object reference not set to an instance of an object.
- NET:Error Creating Control -"Object Reference Not Set To An Instance Of Object"
- vs2015 新建项目时提示Object reference not set to an instance of an object该怎么解决呢
- 我遇到的Object reference not set to an instance of an object.错误的解决办法
- Unity: “NullReferenceException: Object reference not set to an instance of an object”的可能解決方法
- [BTS]Object reference not set to an instance of an object
- VB.NET Error Object reference not set to an instance of an object
- Sharepoint timer job:Object reference not set to an instance of an object
- silverlight beta2.0安装成功后新建silverlight项目出现object reference not set to an instance of an object的解决办法
- 当在一个siliverlight 2.0工程中 添加webservice时 遇到错误:'Object reference not set to an instance of an object' 解决办法
- 关于Unity3D的错误:NullReferenceException: Object reference not set to an instance of an object 的解答
- 新建silverlight项目出现object reference not set to an instance of an object问题
- Object reference not set to an instance of an object
- silverlight beta2.0安装成功后新建silverlight项目出现object reference not set to an instance of an object的解决办法
- 添加wcf服务时弹出"an object reference not set to an instance of an object "
- designer errors: Object reference not set to an instance of an object
- VS2010 出现错误提示“Error Creating Control - Object reference not set to an instance of an objec” 的解决方法
- 《unity手机游戏开发》4.7敌人Object reference not set to an instance of an object