Private Sub Form_Load()
Set cn = New ADODB.Connection
str = "Provider=SQLOLEDB.1;Password=123;Persist Security Info=True;User ID=zl;Initial Catalog=hwsb;Data Source=172.16.1.131"
cn.ConnectionString = str
cn.Open
Adodc1.ConnectionString = str
Adodc1.RecordSource = "select * from jc"
Adodc1.Refresh
End Sub
如果某一字段有可能有空值时,就不要设置非空。