我在写INSERT语句时不知道怎样使用符号&和单引号' ?
现在有4个变量值(id,nm,tp,iw),我想通过insret into 语句写进数据库的表中:txtSQL = "INSERT INTO TInstrument (InstrumentID,InstrumentName,InstrumentType,MinWaveLength,MaxWavelength,Distiguishing,Angle,Manufactory,YieldDate,MarkDate,MarkUnit,Memo) VALUES (................)"
请问省略号部分该怎么写?
现在有4个变量值(id,nm,tp,iw),我想通过insret into 语句写进数据库的表中:txtSQL = "INSERT INTO TInstrument (InstrumentID,InstrumentName,InstrumentType,MinWaveLength,MaxWavelength,Distiguishing,Angle,Manufactory,YieldDate,MarkDate,MarkUnit,Memo) VALUES (................)"
请问省略号部分该怎么写?
请问省略号部分该怎么写?
txtSQL = "INSERT INTO TInstrument(InstrumentID,InstrumentName,InstrumentType,MinWaveLength) VALUES (id)
其他一样
txtSQL = "INSERT INTO TInstrument(InstrumentID,InstrumentName,InstrumentType,MinWaveLength) VALUES ("'"+id+"'","'"+nm+"'","'"+tp+"'"+"'"+iw+"'")
就行了
txtSQL = "INSERT INTO TInstrument(InstrumentID,InstrumentName,InstrumentType,MinWaveLength) VALUES (" & id & "," & nm & "," & tp & "," & iw & " )"
如果是字符型可以用下面的
txtSQL = "INSERT INTO TInstrument(InstrumentID,InstrumentName,InstrumentType,MinWaveLength) VALUES ('" & id & "','" & nm & "','" & tp & "','" & iw & "')"具体哪里要加“'”请查看资料。
就行了