LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default btnUpdate_Click() Question in VBA

I am a Csharp.NET developer with little or no exposure to VB.
I need to connect to a SQL database on a click event, read a number of cells
and insert/update/delete them from a SQL table.

Any guides where I can get help with the slightly different syntax.
Here is the code I want to transform:

Private Sub btnUpdate_Click()

Dim cn As SqlClient.SqlConnection
Dim cmd As SqlClient.SqlCommand
Dim cmdSelect As New SqlClient.SqlCommand

Dim strSQL As String = "UPDATE mis_MISRE_employees SET Logged_In = 'Y'
WHERE uname = '" + UName + "' "
Dim cmdSelect As New SqlClient.SqlCommand
cmdSelect.CommandText = strSQL
cmdSelect.CommandType = CommandType.Text

Try
cn = New SqlClient.SqlConnection("user id=" & UNameLogXML &
";password=" & PasswordLogXML & ";database=" & DatabaseLogXML & ";server=" &
ServerLogXML)
cn.Open()
cmdSelect1.Connection = cn
cmdSelect1.ExecuteNonQuery()
Catch ex As Exception
sqlCnError = ("Error: Could not establish database connection")
End Try

cn.Close()
cn.Dispose()

End Sub

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Newbie Question - Subtraction Formula Question [email protected] Excel Discussion (Misc queries) 3 May 5th 06 05:50 PM
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good davegb Excel Programming 1 May 6th 05 06:35 PM
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good you [email protected] Excel Programming 0 April 27th 05 07:46 PM
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good you [email protected] Excel Programming 23 April 23rd 05 09:26 PM
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good you [email protected] Excel Programming 0 April 22nd 05 03:30 PM


All times are GMT +1. The time now is 01:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"