-1
디버깅이 시작될 때 데이터 테이블에 추가 된 데이터가 보이지 않습니다. 아무런 오류가 없지만 button1을 누르면 오류 (사용자 코드에 의해 처리되지 않음)가 문자 다음에 닫히지 않는 따옴표가 표시됩니다 문자열 ')'oleDbexception이 사용자 코드에 의해 처리되지 않았습니다.
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim con As OleDbConnection
Dim strInsert As String
Dim cmdInsert As OleDbCommand
Dim vt As Byte, vm As Byte
Dim sze As Byte
con = New OleDbConnection("Integrated Security=SSPI;Packet Size=4096;Data Source=.;Tag with column collation when possible=False;Initial Catalog=borjara;Use Procedure for Prepare=1;Auto Translate=True;Persist Security Info=False;Provider=SQLOLEDB.1;Workstation ID=ABDI;Use Encryption for Data=False")
If RadioButton4.Checked = True Then vt = 0
If RadioButton5.Checked = True Then vt = 1
If RadioButton6.Checked = True Then vm = 0
If RadioButton7.Checked = True Then vm = 1
If RadioButton8.Checked = True Then vm = 2
If RadioButton9.Checked = True Then szs = 1
If RadioButton10.Checked = True Then szs = 0
con.Open()
strInsert = "insert Into t1(jens) Values (" & DropDownList1.SelectedItem.Text & "')"
cmdInsert = New OleDbCommand(strInsert, con)
cmdInsert.ExecuteNonQuery()//error is here
con.Close()
con.Open()
strInsert = "insert Into t1(bazsho) Values (" & DropDownList2.SelectedItem.Text & "')"
cmdInsert = New OleDbCommand(strInsert, con)
cmdInsert.ExecuteNonQuery()
con.Close()
con.Open()
strInsert = "insert Into t1(name and lastname,email,number,address,lenght,wideth,turi,glasstype,glass) Values (" & n & ",'" & TextBox1.Text(+"/" + TextBox2.Text & "','" & TextBox3.Text & "','" & TextBox4.Text & "','" & TextBox5.Text & "','" & TextBox6.Text & "'," & vt & "," & vm & "," & szs & "')")
cmdInsert = New OleDbCommand(strInsert, con)
cmdInsert.ExecuteNonQuery()
con.Close()
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
End Sub
최종 클래스
''t1 (jens) 값을 삽입하십시오 ("& DropDownList1.SelectedItem.Text &" ') "'당신은'''''을 가지고 있지 않습니다. 왜 매개 변수를 사용하지 않습니까? 만약 당신이 C#을 사용하지 않는 이유는 무엇입니까? –
나는 C#으로 이것을 썼습니다. 'DropDownList1.SelectedItem.Text'는''); DROP TABLE [Users]; -'왜 그 모든 IDisposable 리소스를 처리하지 않습니까? 하지만 나는 테이블에 텍스트를 삽입 할 때 테이블에 삽입 할 때 오류가없는 다른 문제가 발생했습니다. 코드는 입니다. strsql = "insertandot5 (nameandlastname, number, email, address, + TextBox1.Text + " '+", "+"TextBox1.Text + "'+", " , "+ TextBox4 +" "+", "+ TextBox5 +" '+ ","+ TextBox6 + "')" – jessy
올바른 데이터베이스를 찾고 계신가요? 아마 gett 당신이 그것을 빌드 할 때마다'bin/Debug/whatever.mdf'에 복사됩니다. –