2012-05-17 1 views
0

을 초기화되어 있지 않은 내가 저장 버튼을 클릭하여 해당 오류 매번를 얻었다. 그게 무슨 뜻일까요? ExecuteNonQuery는 연결 속성이

이 내 코드입니다 .. 어떤 응답 이리저리 감사합니다. ;;;

개인 서브 ButtonSave_Click (은 System.Object로 ByVal의 송신자로서 ByVal의 경우 System.EventArgs e)이 ButtonSave.Click 을 핸들 경우 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 

답변

0

어떤 특정 오류가 있습니까? Google에 오류를 부여 할 수 있습니다.

그러나 첫 번째 값 매개 변수에는 작은 따옴표가 없습니다.

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

내가 그것을 시도,

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

덕분에 서지이어야한다. 하지만 난이 오류에 와서 : "NullReferenceExection이 처리되지 않은이었다"이이 한 개인 서브 RefreshData() 에 내 코드가 아닌 경우 con.State = ConnectionState.Open 그런 con.Open() 종료 희미한 다 같이하는 경우 새 OleDb.OleDbDataAdapter ("ID ID로 ID 선택", & _ "[이름, 이름]과 같은 이름 : & _ "에서 ID로 주문 asdf, con) da.Fill (ds.Tables (" asdf을 ")) ' '밀접한 관계 con.Close() 최종 하위 –

+0

당신은 AB겠습니까 내가 'cmd.CommandText'를 붙여 넣으려고 했으니 까. 그렇게 느껴지지 않습니다. –

관련 문제