如果这是一个重复的问题,我道歉,但我似乎无法找到我的特定问题。根据我的错误,我知道我的INSERT语句中的变量没有被分配,但是我发现的每个其他示例都显示哪个变量有问题,而且我的问题,似乎没有变量获得值?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="96dp"
android:layout_marginTop="70dp"
android:weightSum="3"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:weightSum="2"
android:layout_weight="1"
android:layout_marginLeft="@dimen/feed_item_margin"
android:background="@drawable/bg_parent_rounded_corner"
android:orientation="vertical" >
<ImageButton
android:id="@+id/imageButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:background="@null"
android:src="@drawable/user" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:text="Master" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:weightSum="2"
android:layout_weight="1"
android:layout_marginLeft="@dimen/feed_item_margin"
android:background="@drawable/bg_parent_rounded_corner"
android:orientation="vertical" >
<ImageButton
android:id="@+id/imageButton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:background="@null"
android:src="@drawable/report1" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:text="Report" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/feed_item_margin"
android:background="@drawable/bg_parent_rounded_corner"
android:layout_marginRight="@dimen/feed_item_margin"
android:weightSum="2"
android:layout_weight="1"
android:orientation="vertical" >
<ImageButton
android:id="@+id/imageButton3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:background="@null"
android:src="@drawable/expense1" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:text="Expenses" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="96dp"
android:layout_marginTop="70dp"
android:weightSum="3"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:weightSum="2"
android:layout_weight="1"
android:layout_marginLeft="@dimen/feed_item_margin"
android:background="@drawable/bg_parent_rounded_corner"
android:orientation="vertical" >
<ImageButton
android:id="@+id/imageButton4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:background="@null"
android:src="@drawable/collection" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:text="Collection" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:weightSum="2"
android:layout_marginLeft="@dimen/feed_item_margin"
android:background="@drawable/bg_parent_rounded_corner"
android:layout_weight="1"
android:orientation="vertical" >
<ImageButton
android:id="@+id/imageButton5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:background="@null"
android:src="@drawable/monthly" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:text="Report" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:weightSum="2"
android:layout_weight="1"
android:layout_marginLeft="@dimen/feed_item_margin"
android:layout_marginRight="@dimen/feed_item_margin"
android:background="@drawable/bg_parent_rounded_corner"
android:orientation="vertical" >
<ImageButton
android:id="@+id/imageButton6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:background="@null"
android:src="@drawable/extra" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:text="Expenses" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
我要求 updateTable.ExecuteNonQuery(); 我收到此错误:
System.Data.dll中出现'System.Data.SqlClient.SqlException'类型的异常,但未在用户代码中处理
附加信息:必须声明标量变量“@”。
哪些不允许我真正弄清楚问题是什么,任何人都可以推荐我应该修复的内容吗?谢谢!
答案 0 :(得分:6)
@ MEMBER_ZIP
有空格答案 1 :(得分:1)
@和MEMBER_ZIP之间有一个额外的空格:
@ MEMBER_STATE,@ MEMBER_ZIP,@ REGION
修复它:
@MEMBER_STATE,@ MEMBER_ZIP,@ REGION
var sqlStr="INSERT INTO AuthSubmitAppLog (RECEIVED, STATUS_COMMENTS, AUTHORIZATION_NUMBER, CASE_MANAGER, ENTER_DATE, UPDATE_DATE, COMPLETED_BY, COMPLETED_DATETIME, CONTRACT_ENROLL_DATE, CONTRACT_DISENROLL_DATE, DIAGNOSIS_CODE, AUTHORIZATION_TYPE, AUTHORIZATION_TYPE_DETAIL, MEMBER_NAME, MEMBER_ID, MEMBERSHIP_ID, MEMBER_ADDRESS_1, MEMBER_ADDRESS_2, MEMBER_CITY, MEMBER_STATE, MEMBER_ZIP, REGION, MEMBER_PHONE, LINE_OF_BUSINESS, MEDICAID_NUMBER, MEDICARE_NUMBER, MEDICARE_TYPE, VENDOR_NAME, MCO_PROVIDER_NAME, LOCATION_ID, EFFECTIVE_DATE, EXPIRATION_DATE, SERVICE_CATEGORY, DETAIL_NUMBERS, SERVICE_CODE, MODIFIER_1, MODIFIER_2, MODIFIER_3, MODIFIER_4, SUNDAY_UNITS, MONDAY_UNITS, TUESDAY_UNITS, WEDNESDAY_UNITS, THURSDAY_UNITS, FRIDAY_UNITS, SATURDAY_UNITS, TOTAL_UNITS, NOTES_TO_PROVIDER, CASE_TYPE, STATUS, ALTERNATIVE_CASE_NUMBERS, SERVICES_CT_ID) VALUES (@RECEIVED, @STATUS_COMMENTS, @AUTHORIZATION_NUMBER, @CASE_MANAGER, @ENTER_DATE, @UPDATE_DATE, @COMPLETED_BY, @COMPLETED_DATETIME, @CONTRACT_ENROLL_DATE, @CONTRACT_DISENROLL_DATE, @DIAGNOSIS_CODE, @AUTHORIZATION_TYPE, @AUTHORIZATION_TYPE_DETAIL, @MEMBER_NAME, @MEMBER_ID, @MEMBERSHIP_ID, @MEMBER_ADDRESS_1, @MEMBER_ADDRESS_2, @MEMBER_CITY, @MEMBER_STATE,@MEMBER_ZIP, @REGION, @MEMBER_PHONE, @LINE_OF_BUSINESS, @MEDICAID_NUMBER, @MEDICARE_NUMBER, @MEDICARE_TYPE, @VENDOR_NAME, @MCO_PROVIDER_NAME, @LOCATION_ID, @EFFECTIVE_DATE, @EXPIRATION_DATE, @SERVICE_CATEGORY, @DETAIL_NUMBERS, @SERVICE_CODE, @MODIFIER_1, @MODIFIER_2, @MODIFIER_3, @MODIFIER_4, @SUNDAY_UNITS, @MONDAY_UNITS, @TUESDAY_UNITS, @WEDNESDAY_UNITS, @THURSDAY_UNITS, @FRIDAY_UNITS, @SATURDAY_UNITS, @TOTAL_UNITS, @NOTES_TO_PROVIDER, @CASE_TYPE, @STATUS, @ALTERNATIVE_CASE_NUMBERS, @SERVICES_CT_ID)"
SqlCommand updateTable = new SqlCommand(sqlString)
答案 2 :(得分:1)
您不小心在@ MEMBER_ZIP
更改此行:
SqlCommand updateTable = new SqlCommand("INSERT INTO AuthSubmitAppLog (RECEIVED, STATUS_COMMENTS, AUTHORIZATION_NUMBER, CASE_MANAGER, ENTER_DATE, UPDATE_DATE, COMPLETED_BY, COMPLETED_DATETIME, CONTRACT_ENROLL_DATE, CONTRACT_DISENROLL_DATE, DIAGNOSIS_CODE, AUTHORIZATION_TYPE, AUTHORIZATION_TYPE_DETAIL, MEMBER_NAME, MEMBER_ID, MEMBERSHIP_ID, MEMBER_ADDRESS_1, MEMBER_ADDRESS_2, MEMBER_CITY, MEMBER_STATE, MEMBER_ZIP, REGION, MEMBER_PHONE, LINE_OF_BUSINESS, MEDICAID_NUMBER, MEDICARE_NUMBER, MEDICARE_TYPE, VENDOR_NAME, MCO_PROVIDER_NAME, LOCATION_ID, EFFECTIVE_DATE, EXPIRATION_DATE, SERVICE_CATEGORY, DETAIL_NUMBERS, SERVICE_CODE, MODIFIER_1, MODIFIER_2, MODIFIER_3, MODIFIER_4, SUNDAY_UNITS, MONDAY_UNITS, TUESDAY_UNITS, WEDNESDAY_UNITS, THURSDAY_UNITS, FRIDAY_UNITS, SATURDAY_UNITS, TOTAL_UNITS, NOTES_TO_PROVIDER, CASE_TYPE, STATUS, ALTERNATIVE_CASE_NUMBERS, SERVICES_CT_ID) VALUES (@RECEIVED, @STATUS_COMMENTS, @AUTHORIZATION_NUMBER, @CASE_MANAGER, @ENTER_DATE, @UPDATE_DATE, @COMPLETED_BY, @COMPLETED_DATETIME, @CONTRACT_ENROLL_DATE, @CONTRACT_DISENROLL_DATE, @DIAGNOSIS_CODE, @AUTHORIZATION_TYPE, @AUTHORIZATION_TYPE_DETAIL, @MEMBER_NAME, @MEMBER_ID, @MEMBERSHIP_ID, @MEMBER_ADDRESS_1, @MEMBER_ADDRESS_2, @MEMBER_CITY, @MEMBER_STATE,@ MEMBER_ZIP, @REGION, @MEMBER_PHONE, @LINE_OF_BUSINESS, @MEDICAID_NUMBER, @MEDICARE_NUMBER, @MEDICARE_TYPE, @VENDOR_NAME, @MCO_PROVIDER_NAME, @LOCATION_ID, @EFFECTIVE_DATE, @EXPIRATION_DATE, @SERVICE_CATEGORY, @DETAIL_NUMBERS, @SERVICE_CODE, @MODIFIER_1, @MODIFIER_2, @MODIFIER_3, @MODIFIER_4, @SUNDAY_UNITS, @MONDAY_UNITS, @TUESDAY_UNITS, @WEDNESDAY_UNITS, @THURSDAY_UNITS, @FRIDAY_UNITS, @SATURDAY_UNITS, @TOTAL_UNITS, @NOTES_TO_PROVIDER, @CASE_TYPE, @STATUS, @ALTERNATIVE_CASE_NUMBERS, @SERVICES_CT_ID)");
到此:
SqlCommand updateTable = new SqlCommand("INSERT INTO AuthSubmitAppLog (RECEIVED, STATUS_COMMENTS, AUTHORIZATION_NUMBER, CASE_MANAGER, ENTER_DATE, UPDATE_DATE, COMPLETED_BY, COMPLETED_DATETIME, CONTRACT_ENROLL_DATE, CONTRACT_DISENROLL_DATE, DIAGNOSIS_CODE, AUTHORIZATION_TYPE, AUTHORIZATION_TYPE_DETAIL, MEMBER_NAME, MEMBER_ID, MEMBERSHIP_ID, MEMBER_ADDRESS_1, MEMBER_ADDRESS_2, MEMBER_CITY, MEMBER_STATE, MEMBER_ZIP, REGION, MEMBER_PHONE, LINE_OF_BUSINESS, MEDICAID_NUMBER, MEDICARE_NUMBER, MEDICARE_TYPE, VENDOR_NAME, MCO_PROVIDER_NAME, LOCATION_ID, EFFECTIVE_DATE, EXPIRATION_DATE, SERVICE_CATEGORY, DETAIL_NUMBERS, SERVICE_CODE, MODIFIER_1, MODIFIER_2, MODIFIER_3, MODIFIER_4, SUNDAY_UNITS, MONDAY_UNITS, TUESDAY_UNITS, WEDNESDAY_UNITS, THURSDAY_UNITS, FRIDAY_UNITS, SATURDAY_UNITS, TOTAL_UNITS, NOTES_TO_PROVIDER, CASE_TYPE, STATUS, ALTERNATIVE_CASE_NUMBERS, SERVICES_CT_ID) VALUES (@RECEIVED, @STATUS_COMMENTS, @AUTHORIZATION_NUMBER, @CASE_MANAGER, @ENTER_DATE, @UPDATE_DATE, @COMPLETED_BY, @COMPLETED_DATETIME, @CONTRACT_ENROLL_DATE, @CONTRACT_DISENROLL_DATE, @DIAGNOSIS_CODE, @AUTHORIZATION_TYPE, @AUTHORIZATION_TYPE_DETAIL, @MEMBER_NAME, @MEMBER_ID, @MEMBERSHIP_ID, @MEMBER_ADDRESS_1, @MEMBER_ADDRESS_2, @MEMBER_CITY, @MEMBER_STATE, @MEMBER_ZIP, @REGION, @MEMBER_PHONE, @LINE_OF_BUSINESS, @MEDICAID_NUMBER, @MEDICARE_NUMBER, @MEDICARE_TYPE, @VENDOR_NAME, @MCO_PROVIDER_NAME, @LOCATION_ID, @EFFECTIVE_DATE, @EXPIRATION_DATE, @SERVICE_CATEGORY, @DETAIL_NUMBERS, @SERVICE_CODE, @MODIFIER_1, @MODIFIER_2, @MODIFIER_3, @MODIFIER_4, @SUNDAY_UNITS, @MONDAY_UNITS, @TUESDAY_UNITS, @WEDNESDAY_UNITS, @THURSDAY_UNITS, @FRIDAY_UNITS, @SATURDAY_UNITS, @TOTAL_UNITS, @NOTES_TO_PROVIDER, @CASE_TYPE, @STATUS, @ALTERNATIVE_CASE_NUMBERS, @SERVICES_CT_ID)");
答案 3 :(得分:1)
INSERT INTO AuthSubmitAppLog (
RECEIVED
,STATUS_COMMENTS
,AUTHORIZATION_NUMBER
,CASE_MANAGER
,ENTER_DATE
,UPDATE_DATE
,COMPLETED_BY
,COMPLETED_DATETIME
,CONTRACT_ENROLL_DATE
,CONTRACT_DISENROLL_DATE
,DIAGNOSIS_CODE
,AUTHORIZATION_TYPE
,AUTHORIZATION_TYPE_DETAIL
,MEMBER_NAME
,MEMBER_ID
,MEMBERSHIP_ID
,MEMBER_ADDRESS_1
,MEMBER_ADDRESS_2
,MEMBER_CITY
,MEMBER_STATE
,MEMBER_ZIP
,REGION
,MEMBER_PHONE
,LINE_OF_BUSINESS
,MEDICAID_NUMBER
,MEDICARE_NUMBER
,MEDICARE_TYPE
,VENDOR_NAME
,MCO_PROVIDER_NAME
,LOCATION_ID
,EFFECTIVE_DATE
,EXPIRATION_DATE
,SERVICE_CATEGORY
,DETAIL_NUMBERS
,SERVICE_CODE
,MODIFIER_1
,MODIFIER_2
,MODIFIER_3
,MODIFIER_4
,SUNDAY_UNITS
,MONDAY_UNITS
,TUESDAY_UNITS
,WEDNESDAY_UNITS
,THURSDAY_UNITS
,FRIDAY_UNITS
,SATURDAY_UNITS
,TOTAL_UNITS
,NOTES_TO_PROVIDER
,CASE_TYPE
,STATUS
,ALTERNATIVE_CASE_NUMBERS
,SERVICES_CT_ID
)
VALUES (
@RECEIVED
,@STATUS_COMMENTS
,@AUTHORIZATION_NUMBER
,@CASE_MANAGER
,@ENTER_DATE
,@UPDATE_DATE
,@COMPLETED_BY
,@COMPLETED_DATETIME
,@CONTRACT_ENROLL_DATE
,@CONTRACT_DISENROLL_DATE
,@DIAGNOSIS_CODE
,@AUTHORIZATION_TYPE
,@AUTHORIZATION_TYPE_DETAIL
,@MEMBER_NAME
,@MEMBER_ID
,@MEMBERSHIP_ID
,@MEMBER_ADDRESS_1
,@MEMBER_ADDRESS_2
,@MEMBER_CITY
,@MEMBER_STATE
,@ MEMBER_ZIP
,@REGION
,@MEMBER_PHONE
,@LINE_OF_BUSINESS
,@MEDICAID_NUMBER
,@MEDICARE_NUMBER
,@MEDICARE_TYPE
,@VENDOR_NAME
,@MCO_PROVIDER_NAME
,@LOCATION_ID
,@EFFECTIVE_DATE
,@EXPIRATION_DATE
,@SERVICE_CATEGORY
,@DETAIL_NUMBERS
,@SERVICE_CODE
,@MODIFIER_1
,@MODIFIER_2
,@MODIFIER_3
,@MODIFIER_4
,@SUNDAY_UNITS
,@MONDAY_UNITS
,@TUESDAY_UNITS
,@WEDNESDAY_UNITS
,@THURSDAY_UNITS
,@FRIDAY_UNITS
,@SATURDAY_UNITS
,@TOTAL_UNITS
,@NOTES_TO_PROVIDER
,@CASE_TYPE
,@STATUS
,@ALTERNATIVE_CASE_NUMBERS
,@SERVICES_CT_ID
)
特别是:
...
,@MEMBER_CITY
,@MEMBER_STATE
,@ MEMBER_ZIP <--
,@REGION
,@MEMBER_PHONE
,@LINE_OF_BUSINESS
...
@
和MEMBER_ZIP
答案 4 :(得分:1)
从变量'@ MEMBER_ZIP'中删除空格