Problem with querying sql server from vb

前端 未结 3 1909
花落未央
花落未央 2021-01-27 22:31

Whenever I have

Dim catID as integer

And I use this in a query like this:

cmd.CommandText = \"select * from categories where p         


        
3条回答
  •  礼貌的吻别
    2021-01-27 22:48

    Try

    cmd.CommandText = string.Format("select * from categories where parentid='{0}'", catID)
    

    if parentid is a numeric field in your database then you'll need

    cmd.CommandText = string.Format("select * from categories where parentid={0}", catID)
    

提交回复
热议问题