簡體   English   中英

嘗試連接到 SQL 服務器時出現 System.NullReferenceException

[英]System.NullReferenceException when trying to make a connection to an SQL server

我試過這段代碼,但我得到一個 System.NullReferenceException,有人可以幫忙嗎?

string sqlConnection = $"Data Source={dataBaseName};Initial Catalog={serverIP};User 
Id={user};Password={password};Trusted_Connection=true";

SqlConnection connection = new SqlConnection(sqlConnection);
connection.Open();

{System.NullReferenceException:對象引用未設置為對象的實例。 在 Android.Runtime.JNINativeWrapper._unhandled_exception (System.Exception e) [0x0000e] 在 /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:12在 Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPL_V (_JniMarshal_PPL_V 回調,System.IntPtr jnienv,System.IntPtr klazz,System.IntPtr p0) [0x0001d] 在 /Users/runner/work/1/s/xamarin-android/src/Mono。 Android/Android.Runtime/JNINativeWrapper.g.cs:111 at (wrapper native-to-managed) Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPL_V(intptr,intptr,intptr)}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM