本文介绍了附加信息:'nvarchar'附近的语法不正确。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

Dim cmd As New SqlCommand("insert into Baseline(RegNo,HouseNo,FamilyNo,Name,Fname,Employmentstatus,Typeofwork,Gender,[Family members under age of 15],[Family members between age of 15 and 64],[Family members above age of 64/],[Widow],[Blind or very poor eye sight],[Deaf],[Cripple],[How many family members of 15 years and older can read and write],[Returnee from abroad],[Date of last departure  from Host Country],[Date of arrival in present location],[Host country],[Resident in the city >10 years],[Reason for coming to the area],[Municipality tax  Notebook],[Access to Educational institutions],[Access to Health care Centers],[Main source of drinking water],[Main type of latrine],[Drain and street existing condition],[Entitlement status of shelter],[Type of shelter],[Acces to Transport],[Improvement of street and drain],[Potable water],[Latrines],[Clinic],[Formal school],[Literacy course],[Carpet waving],[Health Training],[Computer Training],[Tailoring Training],[Others],[Community contribution in prioritized project],[Name of information provider]) Values(@RegNo,@HouseNo,@FamilyNo,@Name,@Fname,@Employmentstatus,@Typeofwork,@Gender,[@Family members under age of 15],[@Family members between age of 15 and 64],[@Family members above age of 64/],[@Widow],[@Blind or very poor eye sight],[@Deaf],[@Cripple],[@How many family members of 15 years and older can read and write],[@Returnee from abroad],[@Date of last departure  from Host Country],[@Date of arrival in present location],[@Host country],[@Resident in the city >10 years],[@Reason for coming to the area],[@Municipality tax  Notebook],[@Access to Educational institutions],[@Access to Health care Centers],[@Main source of drinking water],[@Main type of latrine],[@Drain and street existing condition],[@Entitlement status of shelter],[@Type of shelter],[@Acces to Transport],[@Improvement of street and drain],[@Potable water],[@Latrines],[@Clinic],[@Formal school],[@Literacy course],[@Carpet waving],[@Health Training],[@Computer Training],[@Tailoring Training],[@Others],[@Community contribution in prioritized project],[@Name of information provider])", cn)

        With cmd.Parameters
            .AddWithValue("@RegNo", txtreg.Text)
            .AddWithValue("@HouseNo", txthouse.Text)
            .AddWithValue("@FamilyNo", txtfamily.Text)
            .AddWithValue("@Name", txtname.Text)
            .AddWithValue("@Fname", txtfname.Text)
            If rbtnempyes.Checked = True Then
                .AddWithValue("@Employmentstatus", rbtnempyes.Text)
            Else
                .AddWithValue("@Employmentstatus", rbtnempno.Text)
            End If
            .AddWithValue("@Typeofwork", cmbwork.Text)
            .AddWithValue("@Gender", cmbgender.Text)
            .AddWithValue("[@Family members under age of 15]", txt15.Text)
            .AddWithValue("[@Family members between age of 15 and 64]", txt64.Text)
            .AddWithValue("[@Family members above age of 64/]", txtabove64.Text)

            .AddWithValue("[@Widow]", SqlDbType.Int).Value = txtwidow.Text

            .AddWithValue("[@Blind or very poor eye sight]", txtblind.Text)
            .AddWithValue("[@Deaf]", txtdeaf.Text)
            .AddWithValue("@[Cripple]", txtcripple.Text)
            .AddWithValue("[@How many family members of 15 years and older can read and write]", txtlitracy.Text)
            If rbtnyesret.Checked = True Then
                .AddWithValue("[@Returnee from abroad]", rbtnyesret.Text)
            Else
                .AddWithValue("[@Returnee from abroad]", rbtnnoretur.Text)
            End If
            .AddWithValue("[@Date of last departure  from Host Country]", datedepar.Value)
            .AddWithValue("[@Date of arrival in present location]", datearrival.Value)
            .AddWithValue("[@Host country]", cmbhost.Text)
            If rbtnyesresidentsinthecity.Checked = True Then
                .AddWithValue("[@Resident in the city >10 years]", rbtnyesret.Text)
            Else
                .AddWithValue("[@Resident in the city >10 years]", rbtnnoresidentsinthecity.Text)
            End If
            .AddWithValue("[@Reason for coming to the area]", cmbreasonforcommingaerea.Text)
            If rbtnyesmunacipilty.Checked = True Then
                .AddWithValue("[@Municipality tax  Notebook]", rbtnyesmunacipilty.Text)
            Else
                .AddWithValue("[@Municipality tax  Notebook]", rbtnnomunacipilty.Text)
            End If
            .AddWithValue("[@Access to Educational institutions]", cmbaccesseducation.Text)
            .AddWithValue("[@Access to Health care Centers]", cmbaccesstohealth.Text)
            .AddWithValue("[@Main source of drinking water]", cmbwater.Text)
            .AddWithValue("[@Main type of latrine]", cmblatrine.Text)
            .AddWithValue("[@Drain and street existing condition]", cmbdrain.Text)
            .AddWithValue("[@Entitlement status of shelter]", cmbstatusshelter.Text)
            .AddWithValue("[@Type of shelter]", cmbtpyeshelter.Text)
            .AddWithValue("[@Acces to Transport]", cmbaccesstotransport.Text)
            .AddWithValue("[@Improvement of street and drain]", cmbpublicneed.Text)
            .AddWithValue("[@Potable water]", cmbpublicneed.Text)
            .AddWithValue("[@Latrines]", cmbpublicneed.Text)
            .AddWithValue("[@Clinic]", cmbpublicneed.Text)
            .AddWithValue("[@Formal school]", cmbpublicneed.Text)
            .AddWithValue("[@Literacy course]", cmbneedfordifferent.Text)
            .AddWithValue("[@Carpet waving]", cmbneedfordifferent.Text)
            .AddWithValue("[@Health Training]", cmbneedfordifferent.Text)
            .AddWithValue("[@Computer Training]", cmbneedfordifferent.Text)
            .AddWithValue("[@Tailoring Training]", cmbneedfordifferent.Text)
            .AddWithValue("[@Others]", cmbneedfordifferent.Text)
            .AddWithValue("[@Community contribution in prioritized project]", txtcommunity.Text)
            .AddWithValue("[@Name of information provider]", txtnameprovider.Text)

            If cn.State = ConnectionState.Closed Then
                cn.Open()
            End If
            cmd.ExecuteNonQuery()

            MsgBox("Record is Successfully Saved", MsgBoxStyle.Information)



        End With

推荐答案


这篇关于附加信息:'nvarchar'附近的语法不正确。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-08 12:39