100分等着你来拿~~~~
大健 2002-08-21 06:06:44 救命呀,出现了问题:
strSQL = " select min(right('00000'+cast(cast(phone_id as int)+1 as varchar(6)),6)) as AAA from Member a "
strSQL &= "where not exists ("
strSQL &= " select * from Member"
strSQL &= " where phone_id=right('00000'+cast(cast(a.phone_id as int)+1 as varchar(6)),6)"
strSQL &= " )"
SQLCmd.CommandText = strSQL
SQLCmd.Connection = MyConn '这connection已经open了
MyDataReader = SQLCmd.ExecuteReader()
theValue=MyDataReader.Item("AA")
出错信息如下:
System.InvalidOperationException: 在没有任何数据时进行无效的读取尝试。 at System.Data.SqlClient.SqlDataReader.PrepareRecord(Int32 i) at System.Data.SqlClient.SqlDataReader.GetValue(Int32 i) at System.Data.SqlClient.SqlDataReader.get_Item(String name) at WebTest.CheckForm.CheckPhoneId(String APhoneId) in C:\Inetpub\wwwroot\WebTest\CheckForm.aspx.vb:line 106
把那SQL语句放到SQL查询分析器里运行,是有返回值的,例如“000005”。