“System.Data.SqlClient.未处理sqlexceptionn”类型的未经处理的异常出现在 System.Data.dll 中。

未处理的“System.Data.SqlClient.SqlException”类型的异常出现在 system.data.dll 中。_百度知道
未处理的“System.Data.SqlClient.SqlException”类型的异常出现在 system.data.dll 中。
求指导!急~~显示在myconn.Open()有误vb.net下编译 Dim myconn As New SqlConnection(&initial catalog=图书馆管理;data source=(local);& & &integrated security=SSPI;&)
Dim sql As String = &Inser订沪斥疚俪狡筹挟船锚t Into 图书表 Values('& & TextBox1.Text & &','& & TextBox2.Text & &','& & TextBox3.Text & &','& & TextBox4.Text & &','& & TextBox5.Text & &','& & TextBox6.Text & &','& & TextBox7.Text & &','& & TextBox8.Text & &','& & TextBox9.Text & &')&
Dim mycmd As New SqlCommand(sql, myconn)
Dim i As Integer
myconn.Open()
i = mycmd.ExecuteNonQuery()
Catch ex As Exception
MsgBox(ex.ToString)
myconn.Close()
MsgBox(i & &条记录添加成功&)
提问者采纳
连接串里面貌似有个分号你打成中文了
提问者评价
啊,谢谢!~~果然是分号问题。
其他类似问题
按默认排序
其他1条回答
在每个conn.Open();加try看一下,可能是连接串写的有问题
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁未处理的“System.Data.SqlClient.SqlException”类型的异常出现在 System.Data.dll 中。
未处理的“System.Data.SqlClient.SqlException”类型的异常出现在 System.Data.dll 中。
哪里错了呢??
用try{}catch{}捕捉异常,查看异常内容.比如:try{//Your database operations}catch(Exception ex){Console.WriteLine(ex.Message);}其中,ex.Message将会包含异常的具体内容.
相关知识等待您来回答
互联网领域专家使用者程式a未 System.Data.SqlClient.SqlException,该怎么解决
&来源:读书人网&【读书人网():综合教育门户网站】
使用者程式a未 System.Data.SqlClient.SqlException笠韵洛e`,因小弟才_始接|.net,所以各位能
使用者程式a未 System.Data.SqlClient.SqlException笠韵洛e`,因小弟才_始接|.net,所以各位能忙分析下xx!!----------------------------------箦e部分------------------------------使用者程式a未&System.Data.SqlClient.SqlException&&HResult=-&&Message=建立B接至&SQL&Server&r,l生W路相P或绦w特定的e`。找不到或o法存取伺服器。_J绦名Q是否正_,以及&SQL&Server&是否O定樵试Sh端B。&(provider:&Named&Pipes&Provider,&error:&40&-&o法_⒅&SQL&Server&的B接)&&Source=.Net&SqlClient&Data&Provider&&ErrorCode=-&&Class=20&&LineNumber=0&&Number=53&&Server=""&&State=0&&StackTrace:&&&&&&&於&System.Data.SqlClient.SqlInternalConnection.OnError(SqlException&exception,&Boolean&breakConnection,&Action`1&wrapCloseInAction)&&&&&&&於&System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject&stateObj,&Boolean&callerHasConnectionLock,&Boolean&asyncClose)&&&&&&&於&System.Data.SqlClient.TdsParser.Connect(ServerInfo&serverInfo,&SqlInternalConnectionTds&connHandler,&Boolean&ignoreSniOpenTimeout,&Int64&timerExpire,&Boolean&encrypt,&Boolean&trustServerCert,&Boolean&integratedSecurity,&Boolean&withFailover)&&&&&&&於&System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo&serverInfo,&String&newPassword,&SecureString&newSecurePassword,&Boolean&ignoreSniOpenTimeout,&TimeoutTimer&timeout,&Boolean&withFailover)&&&&&&&於&System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo&serverInfo,&String&newPassword,&SecureString&newSecurePassword,&Boolean&redirectedUserInstance,&SqlConnectionString&connectionOptions,&SqlCredential&credential,&TimeoutTimer&timeout)&&&&&&&於&System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer&timeout,&SqlConnectionString&connectionOptions,&SqlCredential&credential,&String&newPassword,&SecureString&newSecurePassword,&Boolean&redirectedUserInstance)&&&&&&&於&System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity&identity,&SqlConnectionString&connectionOptions,&SqlCredential&credential,&Object&providerInfo,&String&newPassword,&SecureString&newSecurePassword,&Boolean&redirectedUserInstance,&SqlConnectionString&userConnectionOptions)&&&&&&&於&System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions&options,&DbConnectionPoolKey&poolKey,&Object&poolGroupProviderInfo,&DbConnectionPool&pool,&DbConnection&owningConnection,&DbConnectionOptions&userOptions)&&&&&&&於&System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool&pool,&DbConnectionOptions&options,&DbConnectionPoolKey&poolKey,&DbConnectionOptions&userOptions)&&&&&&&於&System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnectionOptions&userOptions)&&&&&&&於&System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnectionOptions&userOptions)&&&&&&&於&System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection&owningObject,&UInt32&waitForMultipleObjectsTimeout,&Boolean&allowCreate,&Boolean&onlyOneCheckConnection,&DbConnectionOptions&userOptions,&DbConnectionInternal&&connection)&&&&&&&於&System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection&owningObject,&TaskCompletionSource`1&retry,&DbConnectionOptions&userOptions,&DbConnectionInternal&&connection)&&&&&&&於&System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection&owningConnection,&TaskCompletionSource`1&retry,&DbConnectionOptions&userOptions,&DbConnectionInternal&&connection)&&&&&&&於&System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection&outerConnection,&DbConnectionFactory&connectionFactory,&TaskCompletionSource`1&retry,&DbConnectionOptions&userOptions)&&&&&&&於&System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1&retry)&&&&&&&於&System.Data.SqlClient.SqlConnection.Open()&&&&&&&於&mon.TCsLocalSrv.GetDataTable(String&SQL,&String[]&ParamNames,&Object[]&ParamValues)&於&E:\ConferenceRoomsBook\Common\TCsLocalSrv.cs:&行&78&&&&&&&於&mon.TCsEmpInfo.GetEmpInfoByName(String&empUserName)&於&E:\ConferenceRoomsBook\Common\TCsEmpInfo.cs:&行&31&&&&&&&於&ConferenceRoomsBook._Default.DoInit()&於&E:\ConferenceRoomsBook\Default.aspx.cs:&行&25&&&&&&&於&ConferenceRoomsBook._Default.Page_Load(Object&sender,&EventArgs&e)&於&E:\ConferenceRoomsBook\Default.aspx.cs:&行&17
&&&&&&&於&System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object&sender,&EventArgs&e)&&&&&&&於&System.Web.UI.Control.OnLoad(EventArgs&e)&&&&&&&於&System.Web.UI.Control.LoadRecursive()&&&&&&&於&System.Web.UI.Page.ProcessRequestMain(Boolean&includeStagesBeforeAsyncPoint,&Boolean&includeStagesAfterAsyncPoint)&&InnerException:&ponentModel.Win32Exception&&&&&&&HResult=-&&&&&&&Message=找不到W路路。&&&&&&&ErrorCode=-&&&&&&&NativeErrorCode=53&&&&&&&InnerException:&
[解决办法]检查sql&server是否启用tcp/ip协议,防火墙设置,你的连接字符串中的主机和sql&server实例名是否正确。System.Data.SqlClient.SqlException ,找不到存储过程 'sFstArt'_vs2010吧_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0成为超级会员,使用一键签到本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:1,641贴子:
System.Data.SqlClient.SqlException ,找不到存储过程 'sFstArt'收藏
公司网站需要修改图标,我用原来的源程序(未改动过)调试
用户代码未处理 System.Data.SqlClient.SqlException
Message=找不到存储过程 'sFstArt'。
Source=.Net SqlClient Data Provider
ErrorCode=-
LineNumber=1
Number=2812
Procedure=""
StackTrace:
在 System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
在 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
在 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
在 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
在 System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
在 System.Data.SqlClient.SqlDataReader.get_MetaData()
在 System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
在 System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
在 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
在 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
在 System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
在 System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
在 mon.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
在 mon.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
在 mon.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
在 mon.DbDataAdapter.Fill(DataSet dataSet)
在 DB.QueryProc(Int32 id, String procName) 位置 d:\webUI\App_Code\DB.cs:行号 687
在 newsList.Page_Load(Object sender, EventArgs e)
在 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
在 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
在 System.Web.UI.Control.OnLoad(EventArgs e)
在 System.Web.UI.Control.LoadRecursive()
在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
InnerException:
} 由于生成的网站现在都还在用(原版是2011年的),看代码貌似没问题,我以为是编译器和数据库版本不同的问题(现有的SQL2008和VS2010),换为SQL2005和VS2010(确定VS用的2010,用VS2008打开项目提示是高版本创建的),还是提示同样的错误。
出错位置:da.Fill(ds);//将查找出来的数据填充到DataSet中代码如下:public DataSet QueryProc(int id, string procName)
SqlCommand cmd = new SqlCommand();//OleDbCommand表示要对数据源执行的存储过程
mandText = procN//获取要执行的存储过程名
cmd.Connection = myC//获取数据库连接
mandType = CommandType.StoredP//指定执行命令的文本为存储过程
SqlParameter[] p={
new SqlParameter("@id", SqlDbType.Int,4)
p[0].Value=
cmd=CreateCmd(procName,p);
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand =
DataSet ds = new DataSet();//实例化DataSet
da.Fill(ds);//将查找出来的数据填充到DataSet中
cmd.Connection.Close();//返回结果集
} 还有就是在DB.cs里没找到有sFstArt字样 求解!谢谢!
登录百度帐号推荐应用
为兴趣而生,贴吧更懂你。或Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
I keep getting the following error when trying to access a particular webpage.
It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level.
This error can be caused by a virtual directory not being configured as an application in IIS.
When I go into IIS and configure the directory as an application, as the error states I should do, the page seems to await a response, and shows a blank white page, for about 1-2 minutes, then I get the following error:
Server Error in '/inventory' Application.
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SqlException (0x): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +6256377
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +245
System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject) +6270399
System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +181
System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +6271242
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +6271208
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +354
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +703
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +54
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +6272472
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +81
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +1657
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +88
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +6275911
System.Data.SqlClient.SqlConnection.Open() +258
Inventory1.welcome.Page_Load(Object sender, EventArgs e) +219
System.Web.UI.Control.OnLoad(EventArgs e) +132
System.Web.UI.Control.LoadRecursive() +66
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2428
The SQL Server is up and is accessible to all other pages on the site. I have been trying to troubleshoot this error for many hours a day for about a week now with no success. I am new to IIS, and I cannot think of other things to try at this point. I was wondering if someone can help me identify the cause of this error. This particular page was loading and working fine about 2 weeks ago.
369k65656843
2,4541143102
It looks like that what ever you are doing on that page can't access to SQL Server.
How do you connect to database ? Using Windows Authentication or using SQL Server Login ? Do you use impersonation in IIS ? I would guess for example, you are tying to run some SP and this user doesn't have permission to run SP.
Can you check Database Connection accessibility (and availability) using database connection manager in IIS ?
how to do that.
You should definitely leave the virtual directory as an application.
The SQL error is likely something wrong with the connection string.
You said that other pages work...Is there a standard way that all your pages connect to SQL?
Do they all take the connection string from the web.config?
Or is it hard coded on the page?
Your Answer
Sign up or
Sign up using Google
Sign up using Facebook
Sign up using Stack Exchange
Post as a guest
Post as a guest
By posting your answer, you agree to the
Not the answer you're looking for?
Browse other questions tagged
Stack Overflow works best with JavaScript enabled}

我要回帖

更多关于 未处理sqlexception 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信