Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact


Insert into Syntax error


Insert into Syntax error

Author
Message
LovelySingh
LovelySingh
Forum God
Forum God (1.6K reputation)Forum God (1.6K reputation)Forum God (1.6K reputation)Forum God (1.6K reputation)Forum God (1.6K reputation)Forum God (1.6K reputation)Forum God (1.6K reputation)Forum God (1.6K reputation)Forum God (1.6K reputation)

Group: Forum Members
Posts: 4, Visits: 4
Hello All,



I am very new to vb.net and have limited knowledge of the coding part,



My Question is may be very simple to ask, but i m struggling with the insert into statement which i am saving from vb.net to access.



I have Textbox,combobox,radiobuttons & datepickers on the form.



I have tried many things to get this solved, hope this forum will help me in resolving the same.



i am adding a part of my code where its not working,



cmd.CommandText = "INSERT INTO SAMI_Data (RefNo, CustName, EmailSub, ReqName, ReqEntity, Mailbox, SalesRegion, QuoteAttached, OrderType, OrderSubType, ReqSLA, RequestRecDt, Nolinesrec, TargetedDate, TargetStatus, AcknDate, LinesProcessed, Vendor, PricingOwner, ReassignedOwner, Modification, ModificationDate, DataValComm, Quote Created, No Quotes Crt, Site Created, No Sites Created, Case Logged, Case Create date, Case End Date, No Case Logged, Reason for case Log, PO Raised, PO Raised Date, PO Approv Date, No PO Raised, Total QT Cost, Total Revenue, CR Ratio, SSS, Converted into contract, Net Quote Amt, Net Pricing Amt, Curr Req Status, Completion Date, Final Comments) " & _

" VALUES(" & Me.RefNo.Text & ",'" & Me.CstName.Text & "','" & _

Me.EmailSub.Text & "','" & Me.ReqName.Text & "','" & _

Me.ReqEntity.Text & "','" & Me.Mailbox.Text & "','" & _

Me.Salesrgn.Text & "','" & Me.Qtattached & "','" & _

Me.Ordertype.Text & "','" & Me.OrderSubType.Text & "','" & _

Me.ReqSLA.Text & "',#" & Me.Req_Rec_dt.Value.Date & "#,'" & _

Me.Lines_Rec.Text & "','" & Me.TargetDt.Text & "','" & _

Me.TargetStatus.Text & "',#" & Me.Ackn_Dt.Value.Date & "#,'" & _

Me.Lines_Process.Text & "','" & Me.Vendor.Text & "','" & _

Me.Pricing_Owner.Text & "','" & Me.Reassigned_Owner.Text & "','" & _

Me.Modify & "',#" & Me.Modification_dt.Value.Date & "#,'" & _

Me.Data_Val_Com.Text & "','" & _

Me.Quotecreated & "','" & Me.NoQtCrt.Text & "','" & _

Me.Sitecreated & "','" & Me.NoSTCrt.Text & "','" & _

Me.caselogged & "',#" & Me.Cs_crt_Dt.Value.Date & "#,#" &

Me.Cs_End_Dt.Value.Date & "#,'" & Me.No_Cs_Crt.Text & "','" &

Me.Cs_reason.Text & "','" & _

Me.POraised & "',#" & Me.PO_raise_dt.Value.Date & "#,#" & _

Me.PO_Approv_dt.Value.Date & "#,'" & Me.No_PO_Crt.Text & "','" & _

Me.TTL_QT_Cost.Text & "','" & Me.TTL_Revenue.Text & "','" &

Me.CR_Ratio.Text & "','" & Me.SSSupdation & "','" &

Me.convrtintocont & "','" & Me.Net_Vendor.Text & "','" &

Me.Net_Pricing.Text & "','" & Me.Current_Status.Text & "',#" &

Me.CompDt.Value.Date & "#,'" & Me.Final_Comm.Text & "')"

cmd.ExecuteNonQuery()


BRgrds,

LovelySingh
LovelySingh
LovelySingh
Forum God
Forum God (1.6K reputation)Forum God (1.6K reputation)Forum God (1.6K reputation)Forum God (1.6K reputation)Forum God (1.6K reputation)Forum God (1.6K reputation)Forum God (1.6K reputation)Forum God (1.6K reputation)Forum God (1.6K reputation)

Group: Forum Members
Posts: 4, Visits: 4
Hello All,

it would be really appreciate if Anybody can help me ... pls

BRgrds,

LovelySingh

Mark
Mark
Forum God
Forum God (141K reputation)

Group: Moderators
Posts: 1.1K, Visits: 11K
See if this works

cmd.CommandText = "INSERT INTO SAMI_Data (RefNo, CustName, EmailSub, ReqName, " & _
            "ReqEntity, Mailbox, SalesRegion, QuoteAttached, OrderType, OrderSubType, " & _
            "ReqSLA, RequestRecDt, Nolinesrec, TargetedDate, TargetStatus, AcknDate, " & _
            "LinesProcessed, Vendor, PricingOwner, ReassignedOwner, Modification, " & _
            "ModificationDate, DataValComm, [Quote Created], [No Quotes Crt], [Site Created], " & _
            "[No Sites Created], [Case Logged], [Case Create date], [Case End Date], [No Case Logged], " & _
            "[Reason for case Log], [PO Raised], [PO Raised Date], [PO Approv Date], [No PO Raised], " & _
            "[Total QT Cost], [Total Revenue], [CR Ratio], SSS, [Converted into contract], " & _
            "[Net Quote Amt], [Net Pricing Amt], [Curr Req Status], [Completion Date], [Final Comments]) " & _
            " VALUES(" & Me.RefNo.Text & ",'" & Me.CstName.Text & "','" & _
            Me.EmailSub.Text & "','" & Me.ReqName.Text & "','" & _
            Me.ReqEntity.Text & "','" & Me.Mailbox.Text & "','" & _
            Me.Salesrgn.Text & "','" & Me.Qtattached & "','" & _
            Me.Ordertype.Text & "','" & Me.OrderSubType.Text & "','" & _
            Me.ReqSLA.Text & "',#" & Me.Req_Rec_dt.Value.Date & "#,'" & _
            Me.Lines_Rec.Text & "','" & Me.TargetDt.Text & "','" & _
            Me.TargetStatus.Text & "',#" & Me.Ackn_Dt.Value.Date & "#,'" & _
            Me.Lines_Process.Text & "','" & Me.Vendor.Text & "','" & _
            Me.Pricing_Owner.Text & "','" & Me.Reassigned_Owner.Text & "','" & _
            Me.Modify & "',#" & Me.Modification_dt.Value.Date & "#,'" & _
            Me.Data_Val_Com.Text & "','" & _
            Me.Quotecreated & "','" & Me.NoQtCrt.Text & "','" & _
            Me.Sitecreated & "','" & Me.NoSTCrt.Text & "','" & _
            Me.caselogged & "',#" & Me.Cs_crt_Dt.Value.Date & "#,#" & _
            Me.Cs_End_Dt.Value.Date & "#,'" & Me.No_Cs_Crt.Text & "','" & _
            Me.Cs_reason.Text & "','" & _
            Me.POraised & "',#" & Me.PO_raise_dt.Value.Date & "#,#" & _
            Me.PO_Approv_dt.Value.Date & "#,'" & Me.No_PO_Crt.Text & "','" & _
            Me.TTL_QT_Cost.Text & "','" & Me.TTL_Revenue.Text & "','" & _
            Me.CR_Ratio.Text & "','" & Me.SSSupdation & "','" & _
            Me.convrtintocont & "','" & Me.Net_Vendor.Text & "','" & _
            Me.Net_Pricing.Text & "','" & Me.Current_Status.Text & "',#" & _
            Me.CompDt.Value.Date & "#,'" & Me.Final_Comm.Text & "')"

zack
zack
Forum God
Forum God (25K reputation)Forum God (25K reputation)Forum God (25K reputation)Forum God (25K reputation)Forum God (25K reputation)Forum God (25K reputation)Forum God (25K reputation)Forum God (25K reputation)Forum God (25K reputation)

Group: Forum Members
Posts: 102, Visits: 110
You did not say what the problem is. What error message are you getting?
LovelySingh
LovelySingh
Forum God
Forum God (1.6K reputation)Forum God (1.6K reputation)Forum God (1.6K reputation)Forum God (1.6K reputation)Forum God (1.6K reputation)Forum God (1.6K reputation)Forum God (1.6K reputation)Forum God (1.6K reputation)Forum God (1.6K reputation)

Group: Forum Members
Posts: 4, Visits: 4
Hello friends,

First of all thank you so much for your help.

Earlier i was getting an error as "insert into Syntax error"

I have tried the code given by you but it was not working, then i tried adding [ ] for the access coloumns name which was not there , still its not working, Now i m getting error as "No value given for one or more required parameters"

I know i am making a small mistake which i am not able to come with.

It would be really appreciate if any one can really help me out with.

Many thanks friends in advance.

BRgrds,

LovelySingh

LovelySingh
LovelySingh
Forum God
Forum God (1.6K reputation)Forum God (1.6K reputation)Forum God (1.6K reputation)Forum God (1.6K reputation)Forum God (1.6K reputation)Forum God (1.6K reputation)Forum God (1.6K reputation)Forum God (1.6K reputation)Forum God (1.6K reputation)

Group: Forum Members
Posts: 4, Visits: 4
Hello ,

Can any one please help me out with ...

BRgrds,

LovelySingh

Mark
Mark
Forum God
Forum God (141K reputation)

Group: Moderators
Posts: 1.1K, Visits: 11K
Probably the easiest way to do this is open access and create a query in there that works. Copy and paste it into your vb code and replace the insert values with your form fields.
zack
zack
Forum God
Forum God (25K reputation)Forum God (25K reputation)Forum God (25K reputation)Forum God (25K reputation)Forum God (25K reputation)Forum God (25K reputation)Forum God (25K reputation)Forum God (25K reputation)Forum God (25K reputation)

Group: Forum Members
Posts: 102, Visits: 110
Now i m getting error as "No value given for one or more required parameters"







I counted 46 parameters and 46 values so I'm not sure why you're getting this error. Are you sure there's a value in all the fields?
GO


Similar Topics


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....

















A1VBCode Forums


Search