LeVette
asked on
ExecuteScalar Assistance
When executing the below command, the value (Machine Name) isn't being returned and passed into the next command (strQuery2).
Please assist
strQuery = "SELECT SERVERPROPERTY ('MachineName') "
'strQuery2 = "ALTER DATABASE " & database & " & MachineName & " "
Dim cmdr As SqlCommand
Dim cmd As SqlCommand
cmdr = New SqlCommand(strQuery, con)
MachineName = cmdr.ExecuteScalar()
'cmd = New SqlCommand(strQuery2, con)
'cmd.ExecuteNonQuery()
Please assist
strQuery = "SELECT SERVERPROPERTY ('MachineName') "
'strQuery2 = "ALTER DATABASE " & database & " & MachineName & " "
Dim cmdr As SqlCommand
Dim cmd As SqlCommand
cmdr = New SqlCommand(strQuery, con)
MachineName = cmdr.ExecuteScalar()
'cmd = New SqlCommand(strQuery2, con)
'cmd.ExecuteNonQuery()
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.