我正在尝试插入来自select和变量的值:
Sub PasteAndSelectPicture()
Dim ils As Word.InlineShape
Dim shp As Word.Shape
Dim lNrIls As Long
Dim lNrShp As Long
Dim rngDoc As Word.Range
Dim rngSel As Word.Range
Set rngDoc = ActiveDocument.content
Set rngSel = Selection.Range
rngDoc.End = rngSel.End + 1
'Get an InlineShape
lNrIls = rngDoc.InlineShapes.Count
rngSel.Paste
Debug.Print rngDoc.InlineShapes.Count, lNrIls
Set ils = rngDoc.InlineShapes(lNrIls + 1)
ils.width = 255
'Get a pasted Shape
' lNrShp = rngDoc.ShapeRange.Count
' rngSel.PasteAndFormat Type:=wdFormatOriginalFormatting
' Debug.Print lNrShp, rngDoc.ShapeRange.Count
' Set shp = rngDoc.ShapeRange(rngDoc.ShapeRange.Count)
' shp.RelativeHorizontalPosition = wdRelativeHorizontalPositionCharacter
' shp.RelativeVerticalPosition = wdRelativeVerticalPositionLine
' shp.Left = 10
' shp.Top = 10
End Sub
在有和没有VALUES,有和没有IN,有和没有括号的情况下编写它,但是我总是会遇到合奏错误。
我的错误在哪里?
答案 0 :(得分:1)
尝试以下方法:
INSERT INTO routeur (codeAdherent, quantiteArticle, dateFin)
SELECT codeAdherent, @a, @b FROM adherents WHERE categorie = 'G'
答案 1 :(得分:0)
您可以尝试一下:
INSERT INTO routeur (codeAdherent, quantiteArticle, dateFin) VALUES
(SELECT codeAdherent FROM adherents WHERE categorie = 'G', $a, $b);
答案 2 :(得分:0)
您必须仔细阅读INSERT syntax,因为您有很多错误。 这是正确的语法:
INSERT INTO routeur (codeAdherent, quantiteArticle, dateFin)
SELECT codeAdherent, '$a', '$b'
FROM adherents
WHERE categorie = 'G'
PS:为避免使用SQL Injection,应使用Prepared Statements