current user, databind

d2005

Active member
Joined
Aug 31, 2005
Messages
37
Location
ireland
Programming Experience
Beginner
Cmon now take a wee look, update command

i want the textbox to display to the current user,
(who has logged in using username and password )


visual basic code: Dim cmdselect As SqlCommand cmdselect = New SqlCommand("SELECT msg_default from tb_comp_detail ", oSQLConn) txtDefault.Text = cmdselect.ExecuteScalar().ToString()


can i just put in an sql that says "select msg where current user"
DOES ANYONE HAVE ANY IDEAS

i.e. at the minute the txtbox displays the first row in the database
i want the textbox to display the information for the current user
__________________

also what the problem with this update

Line 1: Incorrect syntax near '('.

Line 81: Dim sqlSaveMsg1 As New SqlCommand("update tb_comp_detail (msg_custom1) Values ( txt_msg1.text );", oSQLConn)Line 82: oSQLConn.Open()Line 83: sqlSaveMsg1.ExecuteNonQuery()Line 84: oSQLConn.Close()
 
Last edited:

d2005

Active member
Joined
Aug 31, 2005
Messages
37
Location
ireland
Programming Experience
Beginner
even help with the update command,
ive changed it to this

Dim txt_msg1 As String

txt_msg1 = txtmsg1.Text

Dim sqlSaveMsg1 As New SqlCommand("update tb_comp_detail set msg_custom1 = txt_msg1 ;", oSQLConn)

oSQLConn.Open()

sqlSaveMsg1.ExecuteNonQuery()

oSQLConn.Close()


but get error that txt_msg1 is not in table or in query
 

Blokz

Well-known member
Joined
Jul 31, 2005
Messages
55
Location
Jacksonville, Florida
Programming Experience
5-10
Change:

Dim sqlSaveMsg1 AsNew SqlCommand("update tb_comp_detail set msg_custom1 = txt_msg1 ;", oSQLConn)

To:

Dim sqlSaveMsg1 AsNew SqlCommand("update tb_comp_detail set msg_custom1 = '" & txt_msg1 & "'", oSQLConn)

Blokz
 
Top Bottom