Private Sub Command1_Click()
Adodc1.ConnectionString = "driver={SQL Server};" & "server=user-PC;uid=sa;pwd=lenovo;database=test"
Adodc1.Open
Adodc1.RecordSource = "update table1 set table1.score=score.score from score where table1.studentno=score.studentno "
Text1.Text = Adodc1.Recordset.RecordCount
Adodc1.Refresh
End Sub
用的VB,这是我程序,问题应该出在这句update table1 set table1.score=score.score from score where table1.studentno=score.studentno  因为我把这句换成其他的比如select * from score 就没有问题了,哪位高手能帮忙解答一些这是为什么啊???

解决方案 »

  1.   

    http://www.excelpx.com/home/show.aspx?id=21411&cid=15
    你先搞清楚 RecordSource 这个函数的意义就明白了
      

  2.   

    当然select没错 update有错 update不返回纪录
      

  3.   

    update 不返回记录是啥意思啊? 我就是想知道两个表之间的不同的数量,应该怎么做呢?
      

  4.   

    没这种写法
    update a
    set a.score= b.score 
    from score a inner join score b
    on a.studentno = b.studentno
      

  5.   

    呃 其实table1 是score复制过去的,然后定时比较这两个表,当score有更新的时候对table1 update,再根据recordcount的值判断,是否发生了更新,所以用update了。
    那update 不返回记录是啥意思啊?
      

  6.   

    select 是查询出数据,而update 只是修改数据而已
      

  7.   

    那有啥方法知道是否发生了修改呢?一个VB中可以引用的值,让VB知道表发生了修改