|
-
Mar 6th, 2006, 12:34 PM
#1
Thread Starter
Member
[help] update data to Sql Server
Hi, this time I wan to update tables in my database called "Table". and a session called "MemberDetail" which just contains "id" and "password". Now i want to update the info of Address and City in Table. What code can i use in this case? Can anyone helps me with some codes please? Urgent and thanks.=)
Last edited by asp.net; Mar 6th, 2006 at 12:39 PM.
Reason: wrong title
-
Mar 7th, 2006, 03:29 AM
#2
Thread Starter
Member
Re: [help] update data to Sql Server
Private Sub btnDisplay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplay.Click
Dim SqlCommand As SqlCommand = New SqlCommand
sqlConnection.Open()
SqlCommand.Connection = sqlConnection
Dim sSQL As String
sSQL = "SELECT * FROM Employee_Contact WHERE EmployeeName = @username"
Try
SqlCommand.CommandText = "UPDATE Employee_Contact SET EmployeeID = '" & txtEmpID.Text & "' & EmpAddress= '" & txtEmpAddress.Text & "' & EmpCity ='" & txtEmpCity.Text & "' & EmpZipCode ='" & txtEmpZipCode.Text & "' & EmpState = '" & ddlEmpState.SelectedItem.Value & "' WHERE EmployeeName = @username"
SqlCommand.ExecuteNonQuery()
Catch ex As Exception
Finally
If (sqlConnection.State = ConnectionState.Open) Then
sqlConnection.Close()
End If
End Try
End Sub
End Class
What's wrong with my code? Y i cannot update, cannot run.Search for help, Thanks.
-
Mar 7th, 2006, 03:33 AM
#3
Thread Starter
Member
Re: [help] update data to Sql Server
anyone here can guild me how to use dataAdapter n dataReader these things?add at where? tq.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|