最近车间制造部有需求,需要通过excel填写的ID获取数据库中的某个取值.研究了一下VBA,简要记录一下代码,仅供参考. Function GETPMAX(SID As String) As String Dim result As String '链接数据库 Set Cnn = CreateObject("ADODB.Connection") Set rt = CreateObject("ADODB.Recordset") Cnn.ConnectionString
Function PinYin2(Hz As String) Dim PinMa As String Dim MyPinMa As Variant Dim Temp As Integer, i As Integer, j As Integer PinMa = "a,20319,ai,20317,an,20304,ang,20295,ao,20292," PinMa = PinMa & "ba,20283,bai,20265,ban,20257,bang,20242,b
在工作中经常要将Excel中数据导入数据库,这里介绍一种方法. 假如Excel中的数据如下: 数据库建表如下: 其中Id为自增字段: Excel中数据导入数据库帮助类如下: using System; using System.Data; using System.Data.OleDb; using System.Configuration; using System.Data.SqlClient; /* * 功能:文件操作类(读取.写入) */ namespace ExcelToDataBas