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. Database & SysAdmin
  3. Database
  4. mysql output parameters

mysql output parameters

Scheduled Pinned Locked Moved Database
databasehelpmysqlquestion
2 Posts 1 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.
  • J Offline
    J Offline
    jetset32
    wrote on last edited by
    #1

    Hi, Mikey just sorted out my first problem, the next one is this. In my stored procedure in sqlserver i used OUTPUT Parameters, im not sure i can do this in MYSQL as im not using stored procedure; this is my code; ' the connection string myconnection = New MySqlConnection(ConfigurationSettings.AppSettings("ConnectionString")) ' the query strSQL = "SELECT ?SubDesc=SubDesc, ?SubName=SubCatName FROM SubCategory WHERE SubcatID = ?SubID;" mycommand = New MySqlCommand(strSQL, myconnection) ' Input Parameter Dim parameterSubID As MySqlParameter = New MySqlParameter("?SubID", SubCatID) mycommand.Parameters.Add(parameterSubID) ' Output Parameter Dim parameterSubCatDesc As MySqlParameter = New MySqlParameter("?SubDesc", MySqlDbType.String, 500) parameterSubCatDesc.Direction = ParameterDirection.Output mycommand.Parameters.Add(parameterSubCatDesc) Dim parameterSubName As MySqlParameter = New MySqlParameter("?SubName", MySqlDbType.String, 50) parameterSubName.Direction = ParameterDirection.Output mycommand.Parameters.Add(parameterSubName) ' execute read myconnection.Open() mycommand.ExecuteNonQuery() myconnection.Close() Label1.Text = CStr(parameterSubCatDesc.Value) Label2.Text = CStr(parameterSubName.Value) I dont know if anyone can help me on this? Mike what about this one! Cheers Jetset

    J 1 Reply Last reply
    0
    • J jetset32

      Hi, Mikey just sorted out my first problem, the next one is this. In my stored procedure in sqlserver i used OUTPUT Parameters, im not sure i can do this in MYSQL as im not using stored procedure; this is my code; ' the connection string myconnection = New MySqlConnection(ConfigurationSettings.AppSettings("ConnectionString")) ' the query strSQL = "SELECT ?SubDesc=SubDesc, ?SubName=SubCatName FROM SubCategory WHERE SubcatID = ?SubID;" mycommand = New MySqlCommand(strSQL, myconnection) ' Input Parameter Dim parameterSubID As MySqlParameter = New MySqlParameter("?SubID", SubCatID) mycommand.Parameters.Add(parameterSubID) ' Output Parameter Dim parameterSubCatDesc As MySqlParameter = New MySqlParameter("?SubDesc", MySqlDbType.String, 500) parameterSubCatDesc.Direction = ParameterDirection.Output mycommand.Parameters.Add(parameterSubCatDesc) Dim parameterSubName As MySqlParameter = New MySqlParameter("?SubName", MySqlDbType.String, 50) parameterSubName.Direction = ParameterDirection.Output mycommand.Parameters.Add(parameterSubName) ' execute read myconnection.Open() mycommand.ExecuteNonQuery() myconnection.Close() Label1.Text = CStr(parameterSubCatDesc.Value) Label2.Text = CStr(parameterSubName.Value) I dont know if anyone can help me on this? Mike what about this one! Cheers Jetset

      J Offline
      J Offline
      jetset32
      wrote on last edited by
      #2

      i forgot to say the problem, the code runs but nothing is returned in the labels

      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