Results 1 to 3 of 3

Thread: Simple dataset question

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2001
    Location
    Skandinavian
    Posts
    51

    Lightbulb Simple dataset question

    Hi,

    i have problems with dataset ?

    I have public function with connected in database.
    I want return that function one row in form messagebox.

    Function code like this:

    *Code function

    cn.Open()
    cmd.CommandType = 1
    cmd.CommandText = "select y from XX where zz = @zz"
    cmd.Parameters.Add("@zz", zz)

    Dim aa As SqlDataReader
    aa = cmd.ExecuteReader(CommandBehavior.SingleRow)
    Return aa.GetValue(0)

    When i try get that value in form, it's only show 0. What it wrong or ....


    Tweety99

  2. #2
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    I think it may be you are setting CommandType =1, which is TableDirect, which is not supported with a SQL Connection, only using an OLEDB connection.

  3. #3

    Thread Starter
    Member
    Join Date
    Sep 2001
    Location
    Skandinavian
    Posts
    51
    Number 1 should be CommandType.Text.

    Tweety99

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width