November 27th, 2012, 10:16 AM
I want to update my statement to read 2 values from what is available -
1) user_full_name (concatenation of firstname and lastname) eg., firstname = John lastname= Smith user_full_name = John Smith
2) Initails (First letter of the firstname and first letter of the lastname) e.g., firstname = John lastname= Smith Initials = JS
Please help me;
' Insert a new record into UserProfiles
Dim connectionString As String = ConfigurationManager.ConnectionStrings("CCMSConnectionString").ConnectionString
Dim updateSql As String = "UPDATE dbo.TblUser SET first_name=@FirstName, surname=@LastName, user_full_name=@user_full_name, Initials=@Initials WHERE UserId = @UserId"
Dim fname, lname As String
'Convert new entries to Title Case for consistancy
fname = StrConv(FirstName.Text, vbProperCase)
lname = StrConv(LastName.Text, vbProperCase)
Using myConnection As New SqlConnection(connectionString)
Dim myCommand As New SqlCommand(updateSql, myConnection)
November 27th, 2012, 12:46 PM
Re: Update Statement
It should be pretty simple for you to figure out if you wrote the code you have already. It is simply a matter of combining the fname and lname in one case and in the other a matter of combining the first letter from each of those.
Your question however is worded incorrectly as you are not reading anything with an update statement. Your values are coming from textboxes
Always use [code][/code] tags when posting code.
Click Here to Expand Forum to Full Width