declare @_var INT = 0
set @_var = (select count(1) from SQLTabla where folio = 11801 and RUT_proveedor = '123456-0')
print @_var
select @EmpID = ID from dbo.Employee
Or
set @EmpID =(select id from dbo.Employee)
fuente1
fuente2
select @EmpID = ID from dbo.Employee
Imports System.Data.SqlClient Imports System.IO Public Class SqlCon Public sql As SqlConnection Public str As String = "" Public Sub sqlOpen() str = StringConex() sql = New SqlConnection(str) sql.Open() End Sub Public Sub sqlClose() sql.Close() sql.Dispose() End Sub Public Function StringConex() As String Dim rd As New StreamReader("conex.txt") Dim linea As String = rd.ReadLine() rd.Close() rd.Dispose() Return linea End Function End Class Public Class Form1 Private Sub btn_ok_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_ok.Click Dim con As New SqlCon Try con.sqlOpen() MessageBox.Show("Conexión OK!") con.sqlClose() Catch ex As Exception MessageBox.Show(ex.ToString) End Try End Sub End Class
Private Sub ComboBox1_KeyPress(ByVal sender As System.Object, _ ByVal e As System.Windows.Forms.KeyPressEventArgs) _ Handles ComboBox1.KeyPress e.Handled = True End Sub
Dim fecha_emis As String = DateTimePicker1.Value.ToString("yyyy-MM-dd") Dim fecha_venc As String = DateTimePicker2.Value.ToString("yyyy-MM-dd")
Private Sub DataGridView1_DataError(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewDataErrorEventArgs) Handles DataGridView1.DataError If e.Context = DataGridViewDataErrorContexts.Formatting OrElse DataGridViewDataErrorContexts.PreferredSize Then e.ThrowException = False End If End Sub
Public Function letras_y_numeros(ByVal s As String) As Boolean Dim match As Boolean = False Dim rgx As New Regex("^[a-zA-Z0-9]+$") match = rgx.IsMatch(s) Return match End Functionfuente: http://stackoverflow.com/questions/1181419/verifying-that-a-string-contains-only-letters-in-c-sharp