HOW TO Microsoft SQL Server VB.NET Visual Studio

HOW TO read text from data type Image of Microsoft SQL Server [VB.NET]

The data type image of Microsoft SQL Server is used to store
Variable-length binary data from 0 through 2^31-1 (2,147,483,647) bytes.

The following sample code show how to read text from data type Image using VB.NET:

[sourcecode language=”vb”]
Dim query As String = "SELECT [Image Column] FROM MyTable"
Dim conn As New SqlConnection(connString)
Dim cmd As New SqlCommand(query, conn)

Dim rdr As SqlDataReader = cmd.ExecuteReader(CommandBehavior.SingleRow)

If rdr.Read() Then
Dim i As Integer = rdr.GetOrdinal("Image Column")
If Not rdr.IsDBNull(i) Then
Dim bufferSize = rdr.GetBytes(i, 0, Nothing, 0, Integer.MaxValue) – 1
Dim outbyte(bufferSize) As Byte
rdr.GetBytes(i, 0, outbyte, 0, bufferSize)
Dim enc As New System.Text.ASCIIEncoding
MyTextBox.Text = enc.GetString(outbyte, 0, bufferSize)
End If
End If
‘ Always call Close when done reading


‘ Always call Close when done reading

End Try

Did my HOW TO help you?

7.0 7.5 C#.NET HOW TO Microsoft SDK 7.1 Visual Studio Windows Phone

HOW TO change the StartPage in Windows Phone 7 Application in Visual Studio 2010 [C#.NET]

Expand theĀ Properties folder into Solution Explorer of the VisualĀ C# Windows Phone Application Project and Open the WMAppManifest.xml file.
Change the NavigationPage with you new StartPage filename (case sensitive).

  <DefaultTask Name ="_default" NavigationPage="MainPage.xaml"/>

Did my HOW TO help you? Leave a reply.