//Add Buttoon for adding record protected void btnAdd_Click(object sender, EventArgs e) { Guid id = new Guid(); string Id = id.ToString(); Member member = new Member(); member.ID = Id; member.MemberID = int.Parse(txtMemberID.Text); member.ReceiptNo = txtReceiptNo.Text; member.SurName = txtSurName.Text; member.Name = txtName.Text; member.DateOfBirth = txtDateOFBirth.Text; if (memberService.AddMember(member) == true) LoadData(); //load data method as follows public void LoadData() { List<Member> members = memberService.GetAllMembers(); gvMembers.DataSource = members; gvMembers.DataBind();
Guid id = Guid.NewGuid();
Quote:new Guid() makes an "empty" all-0 guid (00000000-0000-0000-0000-000000000000 is not very useful). Guid.NewGuid() makes an actual guid with a unique value, what you probably want.
System.Guid.NewGuid()
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)