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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. mySQL Problem with .NET

mySQL Problem with .NET

Scheduled Pinned Locked Moved .NET (Core and Framework)
databasecsharphelpasp-netmysql
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.
  • R Offline
    R Offline
    rover_boy
    wrote on last edited by
    #1

    Hi i am tryin to write a login page in asp.net using c# i have created the following method which passes 3 parameters into mySQL database stored procedure but i am having problems extracting the ouptut value from the database and the server returns the following error Only MySqlParameter objects may be stored Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. the piece of code with the error is Line 65: connection.Close(); //Closes DB connection Line 66: Line 67: int valid = cmdString.Parameters.Add ("?p_valid"); Line 68: Line 69: //Builds .net mysql connection and passes connection string into method MySqlConnection connection = new MySqlConnection (connectionString); //Create mySql command string for passing query or SPROC(Stored Procedure) MySqlCommand cmdString = new MySqlCommand(); //Set Command to equal mySql connection,t so can pass SQL query cmdString.Connection = connection; //Set command string to equal SPROC cmdString.CommandText = "login"; cmdString.CommandType = CommandType.StoredProcedure; MySqlParameter param ; //Creats paramter to send to SPROC param = cmdString.Parameters.Add("?p_username", MySqlDbType.VarChar); //Sets parameter type to input parameter param.Direction = ParameterDirection.Input; //Sets parameter value to text box param.Value = txtUsername.Text; //Creats paramter to send to SPROC param = cmdString.Parameters.Add("?p_password", MySqlDbType.VarChar); //Sets parameter type to input parameter param.Direction = ParameterDirection.Input; //Sets parameter value to text box param.Value = txtPassword.Text; //Creates parameter to be passed into procedure param = cmdString.Parameters.Add("?p_valid", MySqlDbType.Int32); //Sets parameter direction to be equal to output param.Direction = ParameterDirection.Output; connection.Open(); //Opens DB connection cmdString.ExecuteNonQuery(); //Runs query connection.Close(); //Closes DB connection

    P 1 Reply Last reply
    0
    • R rover_boy

      Hi i am tryin to write a login page in asp.net using c# i have created the following method which passes 3 parameters into mySQL database stored procedure but i am having problems extracting the ouptut value from the database and the server returns the following error Only MySqlParameter objects may be stored Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. the piece of code with the error is Line 65: connection.Close(); //Closes DB connection Line 66: Line 67: int valid = cmdString.Parameters.Add ("?p_valid"); Line 68: Line 69: //Builds .net mysql connection and passes connection string into method MySqlConnection connection = new MySqlConnection (connectionString); //Create mySql command string for passing query or SPROC(Stored Procedure) MySqlCommand cmdString = new MySqlCommand(); //Set Command to equal mySql connection,t so can pass SQL query cmdString.Connection = connection; //Set command string to equal SPROC cmdString.CommandText = "login"; cmdString.CommandType = CommandType.StoredProcedure; MySqlParameter param ; //Creats paramter to send to SPROC param = cmdString.Parameters.Add("?p_username", MySqlDbType.VarChar); //Sets parameter type to input parameter param.Direction = ParameterDirection.Input; //Sets parameter value to text box param.Value = txtUsername.Text; //Creats paramter to send to SPROC param = cmdString.Parameters.Add("?p_password", MySqlDbType.VarChar); //Sets parameter type to input parameter param.Direction = ParameterDirection.Input; //Sets parameter value to text box param.Value = txtPassword.Text; //Creates parameter to be passed into procedure param = cmdString.Parameters.Add("?p_valid", MySqlDbType.Int32); //Sets parameter direction to be equal to output param.Direction = ParameterDirection.Output; connection.Open(); //Opens DB connection cmdString.ExecuteNonQuery(); //Runs query connection.Close(); //Closes DB connection

      P Offline
      P Offline
      Paul Conrad
      wrote on last edited by
      #2

      Have you resolved this?

      "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon

      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