Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. converting a varchar datatype to a bit data type using VBScript

converting a varchar datatype to a bit data type using VBScript

Scheduled Pinned Locked Moved Visual Basic
databasesql-serversysadmintutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    abhishk2001 yahoo com
    wrote on last edited by
    #1

    Hi, I have a ASP form which has a radio control for "yes/no", and in the SQL server I have a data type bit to store the value, but before inserting the values, how to I convert the value "yes and no" to bit data type. Thanks, abhi abhi

    K 1 Reply Last reply
    0
    • A abhishk2001 yahoo com

      Hi, I have a ASP form which has a radio control for "yes/no", and in the SQL server I have a data type bit to store the value, but before inserting the values, how to I convert the value "yes and no" to bit data type. Thanks, abhi abhi

      K Offline
      K Offline
      KaptinKrunch
      wrote on last edited by
      #2

      Converting a yes/no to a bit.... Enum MyBool YES = 0 NO = 1 End Enum dim bValue as byte bValue = Convert.ToByte(MyBool.YES) Or you could use this method I put together for converting strings Public Sub ConvertStringByte(ByVal stringVal As String) ' Convert the string to a char array Dim chArray() As Char chArray = stringVal.ToCharArray(0, stringVal.Length) 'Convert each char into a byte Dim i As Short Dim b As Byte Dim byArray(stringVal.Length) As Byte For i = 0 To chArray.Length - 1 b = System.Convert.ToByte(chArray(i)) byArray(i) = b Next 'Write each value out and the entire bytes For i = 0 To byArray.Length - 1 Console.Write(byArray(i).ToString() & ":") Next 'Reconstruct the string value and print it For i = 0 To byArray.Length - 1 Console.Write(Convert.ToChar(byArray(i))) Next End Sub

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups