建与数据库的连接(工程里的所有窗体都通过这段代码与数据库连接) Dim connstr As String With cnn '建立数据库连接 .Provider = "SQLOLEDB" .ConnectionString = "User ID=sa;PWD=123456;Data Source=(local);" & _ "Initial Catalog=aa" .Open