亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如下代碼運行后,顯示問題出錯```不支持關鍵字:?為什么呢?

如下代碼運行后,顯示問題出錯```不支持關鍵字:?為什么呢?

侃侃無極 2022-04-08 17:07:54
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Data.SqlClient;namespace 測試2{public partial class Form1 : Form{public Form1(){InitializeComponent();}private void button1_Click(object sender, EventArgs e){//Data Source=L_RYAN-PC\SQLEXPRESS;Initial Catalog=test;Integrated Security=Truestring ConnectionString = "SIMON-PC\\SQLEXPRESS\\SQLEXPRESS;Initial Catalog=Hospetal;Integrated Security=True";using(SqlConnection conn = new SqlConnection())//創建連接對象{conn.ConnectionString = ConnectionString;//給連接對象的連接路徑賦值conn.Open();//運行連接對象,即是連接數據庫SqlCommand cmd = new SqlCommand();//創建命令對象cmd.Connection = conn;//命令對象通過連接對象連接數據庫發送命令cmd.CommandText = "insert into 病人 values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "')";//命令對象發送命令的原文本int i = cmd.ExecuteNonQuery();//運行命令對象MessageBox.Show("插入成功!");}}private void textBox1_TextChanged(object sender, EventArgs e){}}}
查看完整描述

1 回答

?
滄海一幻覺

TA貢獻1824條經驗 獲得超5個贊

string ConnectionString = "server=SIMON-PC\\SQLEXPRESS\\SQLEXPRESS;Initial Catalog=Hospetal;Integrated Security=True";

查看完整回答
反對 回復 2022-04-11
  • 1 回答
  • 0 關注
  • 215 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號