I have used the vb.net 2.0 to update records and to insert records, but not
to retrieve records, haven’t had to.. now I do how to I get the field
information.. I have my example pasted below:
Dim strConncetionstring As String = ""
'connection
If Mdl1.bTrustCon = True Then
'trusted connection
strConncetionstring = "Trusted_Connection=True; Initial
Catalog=" & Mdl1.strDatabase & ";Data Source=" & Mdl1.strServerName & ""
Else
'non-trusted connection
strConncetionstring = "User ID=" & Mdl1.strUser & "; password="
& Mdl1.strPass & "; Initial Catalog=" & Mdl1.strDatabase & ";Data Source=" &
Mdl1.strServerName & ""
End If
Dim myConnection As New SqlConnection(strConncetionstring)
Dim myCommand As String = "select
LTRIM(RTRIM(service_item_group_name)) as SGoupName from sim_groups where
LTRIM(RTRIM(service_item_group_name))='" & strGroupN & "' and
service_item_lib_id='" & strLibID & "'"
Dim da As SqlDataAdapter = New SqlDataAdapter(myCommand, myConnection)
Dim ds As New DataSet
da.Fill(ds) 'filling dataset
If ds.Tables(0).Rows.Count = 0 Then
Return (False) 'creat new
Else
If ds.Tables(0).Rows(1).Item("SGoupName").ToString = strGroupN
Then
Return (True)
End If
End If
da.Dispose()
ds.Dispose()
myConnection.Close()
am I pretty good with the vb.net 2.0 connection, just one thing, how do I
get the record that is in field “SGoupName�
[quoted text, click to view] "Spam Catcher" wrote:
> =?Utf-8?B?QW5kcmV3?= <Andrew@discussions.microsoft.com> wrote in
> news:F54614FF-4675-4A75-9DA2-063AEF33934B@microsoft.com:
>
> > can you give me an example of SQL Parameters
>
> In .NET 2.0:
>
> cmd.CommandText = "INSERT INTO MyTable (SomeValue) VALUES
> (@MyValueParameter)
>
> cmd.Parameters.AddWithValue("@MyValueParameter", SomeValue)
>
> ..NET 1.1 is similar but there is no AddWithValue function :-)
>
> --
> spamhoneypot@rogers.com (Do not e-mail)