qq_38313941
梦清川
采纳率80%
2017-11-16 12:53 阅读 743
已采纳

求助各位大神帮忙解决 C#

图片说明
代码如下:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

    private void button1_Click(object sender, EventArgs e)
    {
        string con;
        con = "Server=.;Database=db;Trusted_Connection=SSPI";
        SqlConnection mycon = new SqlConnection(con);
        mycon.Open();
        string sql = "Select username from Login where username='" + textBox1.Text.Trim() + "'and userpws='" + textBox2.Text.Trim() + "'";
        SqlCommand cmd = new SqlCommand("sql", mycon);
        cmd.CommandType = CommandType.Text;
        mycon.CommandText = sql;
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

相关推荐