本文介绍了Windows窗体与SQL的连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我正在开发一个尝试将前端与后端(SQL)连接的Windows窗体.我已经给了命名空间来获取sql连接

Hi All,
I m developing a windows form trying to connect front end with back end (SQL).I had given name space to get sql connection

using System.Data;


using System.Data.SqlClient;


但是在运行时,它显示错误,表明名称空间不正确.我应该如何处理名称空间?



谢谢&问候
Indrajit


but in run time it is showing error that the name space is not correct . what should I do for name space please help?



Thanks & Regards
Indrajit

推荐答案

using System.data.SqlClient;

然后应允许您输入SqlCommand对象.

试试这个:
如果是您的代码,请找到一个随机方法并输入新行.
在该行上,键入"SqlCommand",不带双引号字符.
当您在末尾键入"d"时,在其下方应显示一个红色的小轮廓栏.
将鼠标移到栏上.应该会出现一个小的下拉列表.
打开下拉菜单.您应该有两个选择:使用System.Data.SqlClient"和"System.Data.SqlClient.SqlCommand".
选择使用"之一-这应该为您插入适当的using语句,并且SqlCommand应该变成浅蓝色.

如果不是这样,那么在哪个阶段它的行为会有所不同?

should then allow you to enter SqlCommand objects.

Try this:
If your code, find a random method and enter a new line.
On that line, type "SqlCommand" without the double quote characters.
When you type the "d" at the end, a small red outlined bar should appear under it.
Move the mouse over the bar. A small drop down should appear.
Open the drop down. Your should have two options: "using System.Data.SqlClient" and "System.Data.SqlClient.SqlCommand".
Select the "using" one - this should insert the appropriate using statement for you, and the SqlCommand should turn light blue.

If it doesn''t happen like this, at which stage does it behave differently?


Imports System.data
Imports System.data.Sqlclient


Imports System.Data
Imports System.data.sqlclient



如果仍然出现错误,则需要创建对system.data.sqlclient的引用.



If it still gives you an error then you will need to create a reference to system.data.sqlclient.


这篇关于Windows窗体与SQL的连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 19:12