I am trying to learn how to create a unique identifer for an SQL database using VB .NET.
Say this is the table, tblMembers in a database designed to track people.
tblMembers has fields
fldUniqueID as uniqueidentifer
fldFName as varchar
fldLName as varchar
When I try to write to the database I get errors that the type is not compatible with type uniqueidentifier.
I could have used typ Int and simply added 1 each time a new record is created, but I want to learn how to use the uniqueidentifier.
Can anyone explain that to me?
This is just an exercise attempt, here is my user control code off the "Add Member" button...
Public Class ucAddMembers
Private Sub btnAddMember_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddMember.Click
Dim UniqueID As ?????
cmdMembers.Connection = cnnMembers
cmdMembers.CommandText = "INSERT INTO tblMembers VALUES('" & UniqueID & "','" & txtFName.Text & "','" & txtLName.Text & "'" & ");"
MsgBox("Record added successfully!")
Catch ex As Exception