Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/visual-studio-2010/4.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
Visual studio 2010 尚未初始化ExecuteOnQuery连接属性_Visual Studio 2010 - Fatal编程技术网

Visual studio 2010 尚未初始化ExecuteOnQuery连接属性

Visual studio 2010 尚未初始化ExecuteOnQuery连接属性,visual-studio-2010,Visual Studio 2010,每次单击“保存”按钮时都会出现该错误。那是什么意思 谢谢你的回复。。这是我的密码 私有子按钮保存\单击(ByVal sender作为System.Object,ByVal e作为System.EventArgs)处理按钮保存。单击 如果con.State=ConnectionState.Closed,则 con.Open() 如果结束 cmd.CommandText = "INSERT INTO tablephotometry(pCode, lampcode, costumer, pro

每次单击“保存”按钮时都会出现该错误。那是什么意思

谢谢你的回复。。这是我的密码

私有子按钮保存\单击(ByVal sender作为System.Object,ByVal e作为System.EventArgs)处理按钮保存。单击 如果con.State=ConnectionState.Closed,则 con.Open() 如果结束

    cmd.CommandText = "INSERT INTO tablephotometry(pCode, lampcode, costumer, proddate, line/shift, watts, volts, filam, base, basepos, lumen, life, atm, fuse, exp, type, testcode, testvolt, datestart, timestart, LNWatts1, LNWatts2, LNWatts3, LNWatts4, LNWatts5, LNLumen1, LNLumen2, LNLumen3, LNLumen4, LNLumen5, LNLPW1, LNLPW2, LNLPW3, LNLPW4, LNLPW5, RLWatts1, RLWatts2, RLWatts3, RLWatts4, RLWatts5, RLLumen1, RLLumen2, RLLumen3, RLLumen4, RLLumen5, LPWF1, LPWF2, LPWF3, LPWF4, LPWF5, InspectionTime1, InspectionTime2, InspectionTime3, InspectionTime4, InspectionTime5, InspectionDate1, InspectionDate2, InspectionDate3, InspectionDate4, InspectionDate5, TH1, TH2, TH3, TH4, TH5, EL1, EL2, EL3, EL4, EL5, Dispo1, Dispo2, Dispo3, Dispo4, Dispo5, CF1, CF2, CF3, CF4, CF5, Reason1, Reason2, Reason3, Reason4, Reason5, TorqueTest, 0Hour, EndOfLife, PFCPTime1, PFCPTime2, PFCPTime3, PFCPTime4, PFCPTime5, PFCPDate1, PFCPDate2, PFCPDate3, PFCPDate4, PFCPDate5, LNAve1, LNAve2, LNAve3, LNAve4, LNAve5, LNAve6, LNAve7, LNAve8, LNAve9, LNAve10, LNAve11, LNAve12, LNAve13, LNsd1, LNsd2, LNsd3, LNsd4, LNsd5, LNsd6, LNsd7, LNsd8, LNsd9, LNsd10, LNsd11, LNsd12, LNsd13) " & _
    "VALUES( " & TextBoxPCode.Text & "','" & TextBoxLampCode.Text & "','" & TextBoxCostumer.Text & "','" _
     & TextBoxProdDate.Text & "','" & TextBoxLS.Text & "','" & TextBoxWatts.Text & "','" & TextBoxVolt.Text & "', '" _
     & TextBoxFilam.Text & "','" & TextBoxBase.Text & "','" & TextBoxBPos.Text & "','" & TextBoxLumen.Text & "','" _
     & TextBoxLife.Text & "','" & TextBoxAtm.Text & "','" & TextBoxFuse.Text & "','" & TextBoxEXPONENT.Text & "','" _
     & TextBoxSampleSize.Text & "','" & TextBoxType.Text & "','" & TextBoxTCode.Text & "','" & TextBoxTVolt.Text & "','" _
     & TextBoxDStart.Text & "','" & TextBoxTStart.Text & "','" & TextBoxLNWatts1.Text & "','" & TextBoxLNWatts2.Text & "','" _
     & TextBoxLNWatts3.Text & "','" & TextBoxLNWatts4.Text & "','" & TextBoxLNWatts5.Text & "','" & TextBoxLNLumen1.Text & "','" _
     & TextBoxLNLumen3.Text & "','" & TextBoxLNLumen4.Text & "','" & TextBoxLNLumen5.Text & "','" & TextBoxLNLPW1.Text & "','" _
     & TextBoxLNLPW2.Text & "','" & TextBoxLNLPW3.Text & "','" & TextBoxLNLPW4.Text & "','" & TextBoxLNLPW5.Text & "','" _
     & TextBoxRLWatts1.Text & "','" & TextBoxRLWatts2.Text & "','" & TextBoxRLWatts3.Text & "','" & TextBoxRLWatts4.Text & "','" _
     & TextBoxRLWatts5.Text & "','" & TextBoxRLLumen1.Text & "','" & TextBoxRLLumen2.Text & "','" & TextBoxRLLumen3.Text & "','" _
     & TextBoxRLLumen4.Text & "','" & TextBoxRLLumen5.Text & "','" & TextBoxLPWF1.Text & "','" & TextBoxLPWF2.Text & "','" _
     & TextBoxLPWF3.Text & "','" & TextBoxLPWF4.Text & "','" & TextBoxLPWF5.Text & "','" & TextBoxInspectionTime1.Text & "','" _
     & TextBoxInspectionTime2.Text & "','" & TextBoxInspectionTime3.Text & "','" & TextBoxInspectionTime4.Text & "','" & TextBoxInspectionTime5.Text & "','" _
     & TextBoxInspectionDate1.Text & "','" & TextBoxInspectionDate2.Text & "','" & TextBoxInspectionDate3.Text & "','" & TextBoxInspectionDate4.Text & "','" _
     & TextBoxInspectionDate5.Text & "','" & TextBoxTH1.Text & "','" & TextBoxTH2.Text & "','" & TextBoxTH3.Text & "','" _
     & TextBoxTH4.Text & "','" & TextBoxTH5.Text & "','" & TextBoxEL1.Text & "','" & TextBoxEL2.Text & "','" _
     & TextBoxEL3.Text & "','" & TextBoxEL4.Text & "','" & TextBoxEL5.Text & "','" & TextBoxDispo1.Text & "','" _
     & TextBoxDispo2.Text & "','" & TextBoxDispo3.Text & "','" & TextBoxDispo4.Text & "','" & TextBoxDispo5.Text & "','" _
     & TextBoxCF1.Text & "','" & TextBoxCF2.Text & "','" & TextBoxCF3.Text & "','" & TextBoxCF4.Text & "','" _
     & TextBoxCF5.Text & "','" & TextBoxReason1.Text & "','" & TextBoxReason2.Text & "','" & TextBoxReason3.Text & "','" _
     & TextBoxReason4.Text & "','" & TextBoxReason5.Text & "','" & TextBoxLNAve1.Text & "','" & TextBoxLNAve2.Text & "','" _
     & TextBoxLNAve3.Text & "','" & TextBoxLNAve4.Text & "','" & TextBoxLNAve5.Text & "','" & TextBoxLNAve6.Text & "','" _
     & TextBoxLNAve7.Text & "','" & TextBoxLNAve8.Text & "','" & TextBoxLNAve9.Text & "','" & TextBoxLNAve10.Text & "','" _
     & TextBoxLNAve11.Text & "','" & TextBoxLNAve12.Text & "','" & TextBoxLNAve13.Text & "','" & TextBoxLNsd1.Text & "','" _
     & TextBoxLNsd2.Text & "','" & TextBoxLNsd3.Text & "','" & TextBoxLNsd4.Text & "','" & TextBoxLNsd5.Text & "','" _
     & TextBoxLNsd6.Text & "','" & TextBoxLNsd7.Text & "','" & TextBoxLNsd8.Text & "','" & TextBoxLNsd9.Text & "','" _
     & TextBoxLNsd10.Text & "','" & TextBoxLNsd11.Text & "','" & TextBoxLNsd12.Text & "','" & TextBoxLNsd13.Text & "','" _
     & TextBoxTorqueTest.Text & "','" & TextBox0Hour.Text & "','" & TextBoxEndOfLife.Text & "','" & TextBoxPFCPDate1.Text & "','" _
     & TextBoxPFCPDate2.Text & "','" & TextBoxPFCPDate3.Text & "','" & TextBoxPFCPDate4.Text & "','" & TextBoxPFCPDate5.Text & "','" _
     & TextBoxPFCPTime1.Text & "','" & TextBoxPFCPTime2.Text & "','" & TextBoxPFCPTime3.Text & "','" & TextBoxPFCPTime4.Text & "','" _
     & TextBoxPFCPTime5.Text & "','" & TextBoxBatchNum.Text & "'," con)

    cmd.ExecuteNonQuery()*************************i always got an error in this part////
    MessageBox.Show("Data Succesfully Added!")
    con.Close()
    RefreshData()
End Sub

它没有给出任何具体的错误吗? 你可能想告诉我们这个错误

但是,在第一个value参数中缺少一个引号

VALUES( " & TextBoxPCode.Text & "','
应该是

VALUES( '" & TextBoxPCode.Text & "','

谢谢Serge,我试过了。但我遇到了这个错误:“NullReferenceExecution未处理”这是我在这个私有子RefreshData()上的代码,如果不是con.State=ConnectionState.Open,那么con.Open()如果Dim da作为新的OleDb.OleDbDataAdapter(“将ID选择为[ID],”&"fname作为[NAME],lname“&"FROM asdf ORDER by ID”,con)da.Fill(ds.Tables(“asdf”)“”close connection con.close()End sub您能否将我粘贴到“cmd.CommandText”,以便我可以查看一下,看看有什么问题。很难这样看。