Solved

insert into table

Posted on 2013-10-25
5
398 Views
Last Modified: 2013-10-27
In mala2DataSet1.xsd

I have a select query  with the executeMod Reader, FillMethodName Fillby_Cod and GetMethodname GetDataBy_cod
in order to populate a DataGridvalue with the cod or heigher number I called:

      Me.AnuncTableAdapter.FillBy_cod(Me.Mala2DataSet1.Anunc, vcod)   and it works fine

I  have to add a row to a table named  "anunc" and populate only the codint field.
With a select query I created inside mala2DataSet1.xsd -  Anunc table -  the following query

      INSERT INTO Anunc (CODINT) VALUES(@codint) and inside the query Builder, the execute Query works well.

the name of the query is  InsertQueryCod2ann, Comand type - text, ComandMod - NonQuery, parameter name - @Codint and DBType = int32

I tried to accomplish results the same way with

       Me.AnuncTableAdapter.InsertQueryCod2ann(Me.Mala2DataSet1.Anunc, vcod)
 
The error message is:

Error      2      Value of type 'CFEMP71.mala2DataSet1.AnuncDataTable' cannot be converted to 'Integer'.      

looking for help

Thanks

Dov
0
Comment
Question by:dovk179
5 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 39602672
Which overloaded update method are you trying to use?  The compiler tries its best to match up parameter types, and when it can't find a match, then it complains...
0
 
LVL 65

Expert Comment

by:Jim Horn
ID: 39602677
>I  have to add a row to a table named  "anunc" and populate only the codint field.
>error message is:

>Error...Value of type 'CFEMP71.mala2DataSet1.AnuncDataTable' cannot be converted to 'Integer'.      

Where in the VB.NET or the SQL does it validate that the value in codint was actually an integer?  For example, if a user typed 'banana' and ran that function, and that was passed, it would return a similar error message.
0
 

Author Comment

by:dovk179
ID: 39602889
Hi,
As you can see I use the wizard for this operation.
in the mala2DataSet1.xsd, table anunc, I create an insert query.

The parameter is @codigo  int 32
I check and execute the query inside the query builder.
I give a number to the value requested  and Ok it.
I receive a confirmation.  
 I verify the result in the preview data window.
Codigo 20226 appears as the last record in the  anunc Table.

I think that the error message:  AnuncDataTable' cannot be converted to 'Integer'
refers to the fact that  data table cannot be converted to an integer and that the query that I wrote - Me.AnuncTableAdapter.InsertQueryCod2ann(Me.Mala2DataSet1.Anunc, vcod) - is Wrong

Looking forward to hear from you

Dov
insert-2.gif
0
 
LVL 27

Accepted Solution

by:
Ark earned 500 total points
ID: 39603382
Me.AnuncTableAdapter.InsertQueryCod2ann(vcod) 'assuming vcod is integer value for @Codint parameter
0
 

Author Closing Comment

by:dovk179
ID: 39603732
Hi,
Thanks a lot. works perfect.
Dov
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

Suggested Solutions

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now