SoFunction
Updated on 2025-03-01

Share examples of writing sqlhelper class by yourself


using System;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
using ; using ;

namespace SqlHelper
{
    /// <summary>
/// Interaction logic
    /// </summary>
    public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();
        }

//It is only used to execute SQL with fewer query results
        private void btnds_Click(object sender, RoutedEventArgs e)
        {
("insert into T_Student(Name,Age) values('Zhang San',55)",
                new SqlParameter[0]);
("Added successfully");
        }

        private void btnDataSet_Click(object sender, RoutedEventArgs e)
        {
            DataSet ds= ("select * from T_Student where hobbit='@hobbit'",
new SqlParameter[]{new SqlParameter("'@hobbit'","hahaha")});
            foreach(DataRow row in [0].Rows)
            {
                string name = (string)row["Name"];
                (name);
            }
        }
    }
}