S
shapper
Hello,
I have an SQL database table with 20 fields: Field_01, Field_02, etc.
I am creating a string with StringBuilder.
I want to include in my string the fields of one record of the
database.
The SQL procedure "GetOneRecord" gets one record when its ID is givem.
So my problem is how to access each record field and use it in my
string.
For example:
MyStringBuilder.Append("<title>")
MyStringBuilder.Append(Field_01) <<<< Field_01 of selected
record.
MyStringBuilder.Append("</title>")
Here is my code:
' Define connection
Dim connection As New
SqlClient.SqlConnection(connectionString.ToString)
' Define command
Dim command As New SqlClient.SqlCommand
With command
.CommandText = "GetOneRecord"
.Connection = connection
.CommandType = CommandType.StoredProcedure
End With
' Add command parameters
With command.Parameters
.Add(New SqlClient.SqlParameter("@Id", Id))
End With
connection.Open()
values in my String Builder.
connection.Close()
How can I do this?
Thanks,
Miguel
I have an SQL database table with 20 fields: Field_01, Field_02, etc.
I am creating a string with StringBuilder.
I want to include in my string the fields of one record of the
database.
The SQL procedure "GetOneRecord" gets one record when its ID is givem.
So my problem is how to access each record field and use it in my
string.
For example:
MyStringBuilder.Append("<title>")
MyStringBuilder.Append(Field_01) <<<< Field_01 of selected
record.
MyStringBuilder.Append("</title>")
Here is my code:
' Define connection
Dim connection As New
SqlClient.SqlConnection(connectionString.ToString)
' Define command
Dim command As New SqlClient.SqlCommand
With command
.CommandText = "GetOneRecord"
.Connection = connection
.CommandType = CommandType.StoredProcedure
End With
' Add command parameters
With command.Parameters
.Add(New SqlClient.SqlParameter("@Id", Id))
End With
connection.Open()
values in my String Builder.
connection.Close()
How can I do this?
Thanks,
Miguel