Я написал код команды insert для вставки записи в таблицу с помощью SQL server 2008
Imports System.Data.SqlClient Imports System.Data.SqlClient.SqlCommand Imports System.IO Public Class MainWindow Dim con As New SqlConnection Dim cmd As New SqlCommand <pre> Private Sub Insert_Click(sender As Object, e As RoutedEventArgs) Handles Insert.Click Try con.ConnectionString = "Data Source=MARVELL-PC;Initial Catalog=Management;User ID=abcd" con.Open() cmd.Connection = con cmd.CommandText = "insert into student(First Name,Middle Name,Last Nameq,Father Name,Mother Name,Occupation,DOB,Mobile No,Email-id,Address,Nationality)values('" & txtbx_student_name.Text & "','" & txtbx_student_mname.Text & "','" & txtbx_student_lname.Text & "','" & txtbx_student_ftname.Text & "','" & txtbx_student_mtname.Text & "','" & txtbx_student_occp.Text & "','" & txtbx_student_dob.Text & "','" & txtbx_student_mb.Text & "','" & txtbx_student_emid.Text & "','" & txtbx_student_addr.Text & "','" & txtbx_student_nat.Text & "')" cmd.ExecuteNonQuery() MessageBox.Show("Data Inserted Sucessfully") Catch ex As Exception MessageBox.Show("Error while inserting a record in a table..." & ex.Message, "Insert Records") Finally con.Close() End Try End Sub What I have tried: It gives the error message "Error while inserting a record in a table, Login failed for the user abcd"
Member 13522006
Пожалуйста, предоставьте мне решение вышеуказанной проблемы, так как у меня есть отображение сообщения об ошибке