首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > VB Dotnet >

大侠提出strids后,运行时myadapter3.Fill(myds3)这句提示')'附近有语法异常.这是哪里的异常呢

2013-03-21 
大侠提出strids后,运行时myadapter3.Fill(myds3)这句提示')'附近有语法错误.这是哪里的错误呢?p

大侠提出strids后,运行时myadapter3.Fill(myds3)这句提示')'附近有语法错误.这是哪里的错误呢?
private strids as string="";
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
           If Not IsPostBack Then
                'dim strids as string=" " 这句移到外面                
                Dim total_topic_num As Integer = 12
                Dim test_topic_num As Integer = 5
                Dim interval As Integer = total_topic_num \ test_topic_num
                Dim big_interval_num As Integer = total_topic_num Mod test_topic_num
                Dim array_topic_id(test_topic_num) As Integer
                Dim i As Integer = 0
                If big_interval_num <> 0 Then
                    For i = 0 To test_topic_num - 1 - big_interval_num
                        Randomize()
                        array_topic_id(i) = Int(interval * Rnd() + i * interval)
                            strids = strids & array_topic_id(i) & ","
                   Next
                    For i = test_topic_num - big_interval_num To test_topic_num - 1
                        Randomize()
                        array_topic_id(i) = (test_topic_num - big_interval_num) * interval + Int((interval + 1) * Rnd() + (i - (test_topic_num - big_interval_num)) * (interval + 1))
        
                             strids = strids & array_topic_id(i) & ","
                   Next


                Else
                    For i = 0 To test_topic_num - 1
                        Randomize()
                        array_topic_id(i) = Int(interval * Rnd() + i * interval)
                              strids = strids & array_topic_id(i) & ","
                   Next
                End If
                
                databind1(strids.trimend(","c)
                End If
          
       End Sub
    
   
    Sub databind1(byval strids as string)
           
            Dim connstr As String
    
           connstr = ConfigurationManager.AppSettings("strconn").ToString
    
           Dim conn As New SqlConnection(connstr)
    
   
          Dim cmd As New SqlCommand("select * from shuju where id in (" & strids  & ") ", conn)         
            conn.Open()
    
           Dim adp As New SqlDataAdapter(cmd)
    
           Dim ds As New DataSet()
    
           adp.Fill(ds, "link")
    
           DataList1.DataSource = ds.Tables("link").DefaultView
    
           DataList1.DataBind()
    
           conn.Close()
        End Sub 
  Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Response.Write("<script lanuage=javascript>alert('您确定要提交这些随机抽查数据吗?');localtion='diaocha.aspx';</script>")
        Button1.Enabled = False


         Dim connstr As String
         connstr = ConfigurationManager.AppSettings("strconn").ToString
         Dim conn As New SqlConnection(connstr)
         Dim myadapter3 As SqlDataAdapter = New SqlDataAdapter("select * from shuju where id in (" & strids & ")", conn)
         Dim myds3 As DataSet = New DataSet()
         myadapter3.Fill(myds3) 运行时这里提示  ')'附近有语法错误          
           Dim a1() As DataRow = myds3.Tables(0).Select()


                    Next
                     For i = test_topic_num - big_interval_num To test_topic_num - 1
                         Randomize()
                         array_topic_id(i) = (test_topic_num - big_interval_num) * interval + Int((interval + 1) * Rnd() + (i - (test_topic_num - big_interval_num)) * (interval + 1))
         
                              strids = strids & array_topic_id(i) & ","
                    Next
                 Else
                     For i = 0 To test_topic_num - 1
                         Randomize()
                         array_topic_id(i) = Int(interval * Rnd() + i * interval)
                               strids = strids & array_topic_id(i) & ","
                    Next
                 End If
                 
                 If Not IsPostBack Then
                 databind1(strids.trimend(","c)
                 End If
           
        End Sub

热点排行