Solved

insert into table

Posted on 2013-10-25
5
404 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

910 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

23 Experts available now in Live!

Get 1:1 Help Now