System.data.dll中发生了类型为'System.NullReferenceException'的未处理异常 [英] An unhandled exception of type 'System.NullReferenceException' occurred in System.data.dll

查看:56
本文介绍了System.data.dll中发生了类型为'System.NullReferenceException'的未处理异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

尝试连接到SQL Server时,我正在使用vb.net 2003和Sql 2000服务器,它会产生错误.
它说"System.data.dll中发生了类型为''System.NullReferenceException''的未处理的异常"

这是代码.请帮帮我.

Hi all,

I am using vb.net 2003 and Sql 2000 server when I am trying to connect to sql server it generates error.
it says "An unhandled exception of type ''System.NullReferenceException'' occurred in System.data.dll"

Here is the code. Please help me.

Private Sub ConnectToSQL()
       Dim con As New SqlConnection
       Dim cmd As New SqlCommand
       con.ConnectionString = "Data Source=(local);Initial Catalog=AACA_Library_db;Persist Security Info=True;User ID=lib;Password=lib"
       con.Open()
   End Sub



预先谢谢您.



Thank you in advance

推荐答案

检查连接字符串.这是检查字符串构造连接字符串 [
Have a check of your connection string. here is a good resource to check the string construction Connection Strings[^]

I would also verify your datasource, catalog, username and password


这篇关于System.data.dll中发生了类型为'System.NullReferenceException'的未处理异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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