在sqlconnection中出错 [英] got a error in sqlconnection

查看:85
本文介绍了在sqlconnection中出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;

public partial class testing : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
          sqlconnection con=new sqlcoonection()


    }



i已正确完成所有操作,但是我在sqlconnection中得到红色下划线,同时在button1_click


i have done everything correctly but i got red underline in sqlconnection while defining under button1_click

推荐答案

下定义C#是区分大小写的,并且确实喜欢正确的拼写,尝试更改:

C# is case sensitive and does like correct spelling as well, try changing:
sqlconnection con=new sqlcoonection()



To

SqlConnection con=new SqlConnection();

(不要忘记行尾的分号)

(Don''t forget the semicolon at the end of the line, either)


了解如何使用IDE!

设置光标进入sqlconnection,并在键盘上键入ctrl + space。瞧,这个词已经改变了一点 - 你看到了区别吗?
Learn how to use your IDE!
Set the cursor into "sqlconnection", and on your keyboard type ctrl+space. And voilà, the word has changed a little - do you see the difference?


试试这个。



SqlConnection sqlConnectionString = new SqlConnection(Data Source = servername; Initial Catalog = dbName; Integrated Security = True);
try this.

SqlConnection sqlConnectionString = new SqlConnection("Data Source=servername;Initial Catalog=dbName;Integrated Security=True");


这篇关于在sqlconnection中出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆