Note that there are some explanatory texts on larger screens.

plurals
  1. POProblems with adding to SQL Server database on vb 2008
    primarykey
    data
    text
    <p>I am having a problem but don't know exactly what is wrong with it my code is below:</p> <pre><code>Imports System.Data.SqlClient Imports System.Data Public Class FormAdd Private Sub btnBack_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBack.Click FormAdmin.Show() Me.Hide() End Sub Private Sub btnAdd_Click(ByRef Success As String, ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click Call AddUser(Success) MsgBox(" " &amp; Success &amp; " ") End Sub Private Sub AddUser(ByRef Success As String) lblAdmin.Text = Str(chkAdminAccount.Checked) Dim con As New SqlConnection Dim lrd As SqlDataReader Dim inscmd As New SqlCommand inscmd.Parameters.AddWithValue("@Username", txtUsername.Text.Trim()) txtUsername.Text = txtUsername.Text inscmd.Parameters.AddWithValue("@Password", txtPassword.Text.Trim) txtPassword.Text = txtPassword.Text inscmd.Parameters.AddWithValue("@Name", (txtName.Text.Trim)) txtName.Text = txtName.Text inscmd.Parameters.AddWithValue("@AdminAccount", lblAdmin.Text.Trim) lblAdmin = lblAdmin con.ConnectionString = "Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\Alwyn\Desktop\Computing A2 Alwyn\Comp4ProjectRoomBookingSystem\WindowsApplication1\WindowsApplication1\Database1.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True" Try con.Open() inscmd.CommandText = "INSERT INTO Admin (Username, Password, Name, AdminAccount) VALUES (@Username, @Password, @Name, @AdminAccount)" inscmd.Connection = con inscmd.ExecuteNonQuery() Catch ex As Exception MsgBox("Could not add User" &amp; ex.Message &amp; " ") Finally con.Close() inscmd.Parameters.Clear() Success = "User has been added" End Try End Sub End Class </code></pre> <p>If you could help it would be much appreciated error message is as follows:</p> <blockquote> <p>Method 'Private Sub btnAdd_Click(ByRef Success As String, sender As Object, e As System.EventArgs)' cannot handle event 'Public Event Click(sender As Object, e As System.EventArgs)' because they do not have a compatible signature. C:\Users\Alwyn\Desktop\Computing A2 Alwyn\Comp4ProjectRoomBookingSystem\WindowsApplication1\WindowsApplication1\FormAdd.vb 10 130 WindowsApplication1</p> </blockquote> <p>Many thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload