日期:2014-05-19  浏览次数:20505 次

帮帮忙!输入字符串的格式不正确
Sub   getaidlist()  
mysql   =   "select   *   from   akinds   order   by   id   asc "  
Dim   mycon   As   OleDb.OleDbConnection   =   New   OleDb.OleDbConnection(constr)  
mycon.Open()  
Dim   mycmd   As   OleDb.OleDbCommand   =   New   OleDb.OleDbCommand(mysql,   mycon)  
Dim   myreader   As   OleDb.OleDbDataReader  
myreader   =   mycmd.ExecuteReader  
dropdownlist1.Items.Clear()  
Do   While   myreader.Read  
dropdownlist1.Items.Add(New   ListItem(myreader( "akinds "),   myreader( "id ")))  
Loop  
dropdownlist1.Items.Add(New   ListItem(( "所有类别 "),   "X "))  
dropdownlist1.SelectedIndex   =   dropdownlist1.Items.Count   -   1  
End   Sub  

Private   Sub   dropdownlist1_SelectedIndexChanged(ByVal   sender   As   Object,   ByVal   e   As   System.EventArgs)   Handles   dropdownlist1.SelectedIndexChanged  
If   dropdownlist1.SelectedIndex   <>   "X "   Then  
viewstate( "sql ")   =   "select   id,title,writer,sdate   from   articles   where   akinds= "   +   dropdownlist1.SelectedIndex.ToString   +   "   order   by   id   desc "  
getdata2()  
End   If  
End   Sub  

在这里出错了:If   dropdownlist1.SelectedIndex   <>   "X "   Then  

提示:System.FormatException:   输入字符串的格式不正确  

高手帮帮我,谢谢了!


------解决方案--------------------
打死不看VB,眼花
------解决方案--------------------
If dropdownlist1.SelectedValue <> "X " Then