Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql server excel VBA上载SQL记录集_Sql Server_Sql Server 2012_Sql Insert_Import From Excel - Fatal编程技术网

Sql server excel VBA上载SQL记录集

Sql server excel VBA上载SQL记录集,sql-server,sql-server-2012,sql-insert,import-from-excel,Sql Server,Sql Server 2012,Sql Insert,Import From Excel,我不知道如何使用Microsoft SQL Server 2012上载到SQL,但我已经知道如何使用以下方法上载记录集以访问: acc.DoCmd.TransferSpreadsheet_ 进口, SQL数据库表称为索引,excel工作表名为index2,要上载的数据位于A2:Y2 到目前为止,这就是我想到的 子上传 将cnn设置为ADODB.Connection Dim strConnectionString作为字符串 将sh设置为工作表 将暗条纹插入为字符串 长得一样长 设置sh=图纸索引

我不知道如何使用Microsoft SQL Server 2012上载到SQL,但我已经知道如何使用以下方法上载记录集以访问:

acc.DoCmd.TransferSpreadsheet_ 进口, SQL数据库表称为索引,excel工作表名为index2,要上载的数据位于A2:Y2

到目前为止,这就是我想到的

子上传 将cnn设置为ADODB.Connection Dim strConnectionString作为字符串 将sh设置为工作表 将暗条纹插入为字符串 长得一样长 设置sh=图纸索引 设置cnn=newadodb.Connection strConnectionString=提供程序=截断' “开始 打开strConnectionString strInsert=插入索引Qnumber,边距值和-rs2.FieldSheetsindex2.Rangea1.Value和&rs2.FieldSheetsindex2.Rangea2.Value和; 调试。打印strInsert CurrentDb.executestrinsert,dbFailonerror
您使用的是哪种SQL RDBMS?我使用的是Microsoft SQL server 2012所以,您试图将excel数据加载到SQL server表中?是的,我有一个excel表,我们计算价格,然后我们从excel表中取出一段数据,并在SQL数据库中另存为新记录,我们已经使用它好几个月了,但是旧的excel将数据推送到access数据库,现在我们已经移动到sql系统,不再具有访问权限。