Insertcommand in TableAdapter

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • phanimadhav
    New Member
    • Jun 2007
    • 78

    Insertcommand in TableAdapter

    Hello experts,
    I have small problem for inserting values into Mysqldatabase by using tableadapter in asp.net.passing the parameter values through webmethods.So any one please helpme.How to make the insertcommand through parameters.Than ks for advanced reply
  • kspiros
    New Member
    • Oct 2008
    • 16

    #2
    i would suggest you not to use the clicked .net way in order to connect to database. you can do something like this to update you database
    Code:
    using MySql.Data.MySqlClient;
    using MySql.Data.Types;
    
    MySqlConnection mysqlCon = new MySqlConnection(strProvider);
    
    string strSQL = "update table set table.something=@alpha";
    MySqlCommand mysqlCmd = new MySqlCommand(strSQL,mysqlCon);
    mysqlCmd .Parameters.Add("@alpha", SqlDbType.SmallInt).Value = X
    
                // open the connection 
                mysqlCon .Open();
                // do some operations ...
                mysqlCmd .ExecuteNonQuery();
                
    
                // close the connection
                mysqlCon .Close();

    Comment

    Working...