Why queries added to QueriesTableAdapter don't work?

Greetings community,
Greetings community,
First, my apology for not putting the code in the code window, but when I try to do this with more than one code window, posting doesn’t work. I tried to mix one SQL code window and two VB.NET code windows, but posting simply crashed.
This is part of bigger app, but I’ve created simple example on SQL server express 2012: database (DBQueriesProbe) of only one table (dbo.LookUP) and two functions (GetIDFromName and NameExist).
I populated the table with: Item01, Item02, Item03.
Then, I opened VS started new winform project. I added new data source from that database selecting only my table and those functions. I built the app, opened data set designer and got my table with its table adapter and another rectangle
named QueriesTableAdapter with my two functions.
CREATE TABLE [dbo].[LookUP](
[ID] [int] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](50) NOT NULL,
 CONSTRAINT [PK_LookUP] PRIMARY KEY CLUSTERED
[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
CREATE FUNCTION [dbo].[GetIDFromName](@Name nvarchar(50))
RETURNS int
AS
BEGIN
-- Declare the return variable here
DECLARE @ResultVar int
-- Add the T-SQL statements to compute the return value here
SELECT @ResultVar = ID from dbo.LookUP where Name=@Name
if @@ROWCOUNT=0 set @ResultVar=0
-- Return the result of the function
RETURN @ResultVar
END
CREATE FUNCTION [dbo].[NameExist](@Name as nvarchar(50))
RETURNS bit
AS
BEGIN
DECLARE @ResultVar bit
Declare @SelTable as table (ID int,Name nvarchar(50))
insert into @SelTable select * from dbo.LookUP where Name=@Name
if @@ROWCOUNT>0 set @ResultVar=1 else set @ResultVar=0
RETURN @ResultVar
END
GO
I right-clicked on LookUPTableAdapter, and selected preview data. Results were expected. When I tried to do the same with functions, preview for them was not available. Not knowing any better, I added another query in Queries table adapter,
creating it from stored procedure GetIDFromName, only changing its name to fGetIDFromName, because you cannot have two queries with the same name. This new query appeared in preview menu, but as function of dataset not as function of QueriesTableAdapter. This
new query returned result as expected.
But now, I come to interesting part. I didn’t want to bind data to something on the form. I wanted to try those functions. So I added new module to the project (DataManagement) with this code.
Module DataManagement
    Public dsQP As New DBQueriesProbeDataSet
    Public taLookUP As New DBQueriesProbeDataSetTableAdapters.LookUPTableAdapter
    Public taQueries As New DBQueriesProbeDataSetTableAdapters.QueriesTableAdapter
    Public tamQP As New DBQueriesProbeDataSetTableAdapters.TableAdapterManager
    Public bsLookUP As New BindingSource
    Public Sub InitDataManagement()
        tamQP.LookUPTableAdapter = taLookUP
        taLookUP.Fill(dsQP.LookUP)
        bsLookUP.DataSource = dsQP
        bsLookUP.DataMember = dsQP.LookUP.TableName
    End Sub
End Module
On the form I just added one multiline text box to show the results. In form load event I added this code
Public Class Form1
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        InitDataManagement()
        Dim sMess As String = ""
        bsLookUP.MoveFirst()
        Dim CurLU = CType(CType(bsLookUP.Current, DataRowView).Row, DBQueriesProbeDataSet.LookUPRow)
        sMess = CurLU.Name & vbCrLf
        sMess &= CInt(taQueries.GetIDFromName(CurLU.Name)).ToString & vbCrLf
        sMess &= CInt(taQueries.fGetIDFromName(CurLU.Name)).ToString & vbCrLf
        sMess &= CBool(taQueries.NameExist(CurLU.Name)).ToString
        TextBox1.Text = sMess
    End Sub
End Class
And got this as a result
Item01
1
0
True
And this shows that functions from QueriesTableAdapter added by dataset designer worked, but the one added manually didn’t work, even though it was created from the same “stored” function.
Can anyone explain this?

Hi lvicaNesic,
I have reproduced your code, if you want to Preview data from the QueriesTableAdapter which was added manually, you could do as below:
1.Right-Click the “NameExist” and choose the “Configure”
2.Choose the “NameExist” and click the “Next”
3.Choose the “A single value” and click the “Next”
4.The new function name is default, click “Next” and then click “Finish”
At last, you could choose the Preview data and the result will appear.
If you have any further questions, please feel free to post in this forum.
Best Regards,
Edward
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a
href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.

Similar Messages

  • Why my ipod touch buttons don't work?

    Last nigth I was listening to my music library and after a few hours I fell asleep. This morning, both home and sleep button stopped working. Could anyone tell what is wrong with my ipod touch...??

    If you've reset and restored and the buttons still don't work, then it needs service. Either take it along to an Apple store, or send it in.
    http://depot.info.apple.com/ipod/

  • I need some help figuring out why parts of my form don't work

    I have built a couple forms to use with my work, the first 1 is a write up sheet that I fill out while on a field job. When complete, I have an insert button that inserts times, dates customer info and employee info into a MYSQL database that is pertinent to the second form  which is a standard type timecard. It is with the timecard form that I am having problems. On the timecard form I have a radio button list with seven buttons (1 for each "start/stop" row of the timecard) when I click a button it makes a subform on the second page visible that allows me to insert the data from my database into the start/stop field of the timecard. I used the action builder to make these subforms visable and invisible and this all works except for 1. Also one of the subforms won't insert the data. I can't for the life of me figure out why, I have gone over both problems and don't see anything to cause it. I was hoping that I could upload my form and database somewhere and have somebody look it over, maybe I have overlooked something but at this point I have studied the problems for 3 days and haven't figured either out.  any help would be greatly appreciated
    Thanks

    Yes, after the last iOS.  So is that different than the App update I just did through the app store?  Or is there a different version app that I need to go download again? 

  • Help!!!why the flag " jsp:forward" don't work?

    the code like this:
    <%@page buffer="none" autoFlush="true" %> //attention: buffer="none"
    <%
    long i=0;
    for(i=0;i<10;i++)
    out.println("@@@@@@@@@@@@@@@@@");
    %>
    <jsp:forward page="test.jsp" />
    but it not turn to the page "test.jsp".Why?

    but it not turn to the page "test.jsp".Why? because of your page buffer being none.
    According to the API:
    forward should be called before the response has been committed to the client (before response body output has been flushed). If the response already has been committed, this method throws an IllegalStateException. Uncommitted output in the response buffer is automatically cleared before the forward.
    Having a buffer of "none" means that any output you do is sent immediately, and is committed. So you can't forward/redirect after you start output.
    Solution: give the page a buffer. Remove that page directive, and it should work.
    Cheers,
    evnafets

  • Why Speedbit Video downloader Toolbar don.t work in Firefox 8. Works ok in 7

    I have been using Speedbit Video Downloader Toolbar with Firefox 7 for downloading web video. When i upgraded to Firefox 8 the Toolbar was no longer compatable, so i went back to Firefox 7 and all was ok again. Is there a fix for this. I am including the url.
    http://www.speedbit.com/video/

    The latest version of SPEEDbit Video Downloader 3.0.1 (www.speedbit.com/video) is compatible with FireFox 8/9
    Open Tools->Add-ons->Extensions and check if the SPEEDbit Video Downloader add-on is enabled.

  • Why my screen iphone don't work well?

    Why my iphon's screen don't work well?

    Two things to try:
    First, reset the phone by holding the sleep and home button until the Apple logo comes back again. You will not lose data by resetting.
    If this does not work, set it up as new device, explained in this article:
    How to back up your data and set up as a new device
    If still no luck, your hardware might be damaged and the phone has to be serviced.
    iPhone - Contact Support - Apple Support

  • 1..n cardinality mapping don't  work

    Hi Experts
    I've created a web dynpro application, with context Orders , it cardinality is 1..n.
    In BPM Diagram Editor in NWDS, i create an activity, create a task to this web dynpro component.
    When i get the context of this web dynpro, and try to map with TaskOutput of Acticity, some errors happen in the link of the maps(appear one red X ).
    To make a test, i put the cardinality as 1..1, and all is OK.
    Can someone explain me, why 1..n cardinaity don't work? I am doing something wrong?
    I need to expose in other activity a list of Orders returned from the first Activity. How can i do this?
    I try to find any solution, but no success.
    Regards
    Marcos.

    Hi Marcos,
    Please be aware of the fact that the root nodes from 1...n to 1...n nodes need to be mapped as well and then you can do the mapping below the nodes individually. For example:
    A (1...n)
    -A1
    -A2
    -A3
    B (1...n)
    -B1
    -B2
    -B3
    -> First map A and B
    -> Then map the individual elements (like A1 -> B3, A2 -> B1, A3 -> B1)
    Let me know if that worked out for you.
    Cheers,
    Martin

  • Floppy don't work with bios V3.5 (MEGA180)

    Excuse me for may poor English, I'm Italian
    Why the floppy 3,5" don't works upgrading Mega180' bios to V3.5?
    What's the problem? I must only downgrade the bios to V3.4?
    Thank's
    Oreste

    After I install 10.5 the mousecursor jumped on the screen uncontrolable. If I moved the mouse down, the cursor jumped up and other curious movements. If I scroll in a textfile, little square imprints stay under the cursor and destroyed the text on the screen. After moving the cursor out and scroll the corrupt pane out of the screen and back it was restored. This was a graphicproblem so I searched for drivers, installed them and it was resolved. After release 10.5.2 I deinstall all drivers, install OSX komplete new and found the same prob. I testet three different mice: the original Apple-mouse, my logitech and an old one I used with my G3 long time ago. The same phenomene in all cases.

  • Adding swf (Captivate clips) into RoboHelp: flash controls don't work

    Hi all,
    I've added captivate swf project and ALL the flash controls (toc, play etc) don't work, though it plays continuously from the beginning. If I extract that page HTML code and play it separately, it works on all browsers. I render RoboHelp projects as MS HTML Help.
    Are there any known issues with rendering flash clips in Microsoft HTML Help? it looks as it is using some weird embedded browser for swf.
    any suggestions?
    thanks

    Hi again
    Okay, this gets curiouser and curioser the more I look at it.
    At first blush it appeared things were working. Then I tried the playback controls. Odd, the controls will allow a single click and they will carry out whatever function you clicked. But that seems to be it. Further clicks appear to be disallowed. I tested with a fresh Captivate movie as well as one that uses the Domain Lock Widget.
    Wondering if this was an overall issue with SWF content in general or if it was simply tied to the Playback Controls, I then tried adding some button objects to each slide to allow the user to navigate from slide to slide. This seems to work.
    I thought (hoped actually) that perhaps it was simply the default playback controls causing the issue. Unfortunately it doesn't seem to be. I tried creating a SWF using the Aluminum controls. Same issue.
    At this point I have to admit that I'm more than a little stumped. I'm surprised that I've not heard of this before or that others haven't reported it. However, I use Captivate files in my CHM files all the time. The main difference is that I never use playback controls in my movies. I am always using either Buttons or Click Boxes to navigate.
    So being generally unsatisfied and poking it further, I seem to have found the culprit. I did the same thing in RoboHelp 7 and there wasn't an issue. What was different? I scrutinized the code and there was no difference. Hmmm
    Then it hit me. The difference here was that where the Captivate playback control only functioned after the first click, the RoboHelp project was using Browse Sequences. So I edited the window definition and turned them off. BINGO! The Captivate works fine now.
    I also tested using RoboHelp 7. Same issue there as well.
    Definitely this should be reported to Adobe as a bug. Link is in my sig.
    Cheers... Rick
    Helpful and Handy Links
    RoboHelp Wish Form/Bug Reporting Form
    Begin learning RoboHelp HTML 7 or 8 within the day - $24.95!
    Adobe Certified RoboHelp HTML Training
    SorcerStone Blog
    RoboHelp eBooks

  • The Facebook Notifications don't work on my iPod Touch! Why?

    The Facebook Notifications don't work on my iPod Touch! Why?

    Are they turned on in Settinfs>FaceBook>Notifications?
    Also see the previous discussions on the right side of this page with FacBood notification  questions.

  • Why don't work adobe reader XI on my laptop with windows 7 home premium? Thanks for advance.

    Why don't work adobe reader XI on my laptop with windows 7 home premium? Thanks for advance

    Hard to say. Please let us know exactly the problem, including messages in full.

  • Why the 3G connection with Wind don't work on iPhone 4S (iOS 5.0)??

    Why the 3G connection with Wind don't work on iPhone 4S (iOS 5.0)??

    Because Wind is not an officially supported iPhone carrier and Apple warns that using an iPhone on a non-supported carrier's network may mean that some features may not be available or work at all.

  • I downloaded CS6 Red Plug-In and added to Package Contents, replaced the current files with the new without backing up, now my RED footage thumbnails and color-correction don't WORK! How do I get my old importerRed file back!!?? HELP!

    I downloaded CS6 Red Plug-In and added to Package Contents, replaced the current files with the new without backing up, now my RED footage thumbnails and color-correction don't WORK! How do I get my old importerRed file back!!?? HELP!

    Try asking in the Premiere Pro  forum seems to be an Adobe Lab for Premiere Pro

  • Javascript games that work in IE don't work in Firefox - why?

    Why can't I get javascript games that work in IE to work in Firefox? The javascript games show up on the page but not in the correct format and the scripts don't work. An example is here: http://www.cornwallfoodandfarming.net/games/KS1-summer-in-farm3/picture-memory.htm
    When you open it in IE you can see what it should do!
    Any help gratefully received. Cheers...Paul

    That particular game was created a long time ago... in the age of Netscape version 4.
    Netscape version 4 had proprietary objects named layers that are no longer supported in Firefox, so the game fails because it assumes that Firefox supports layers. You can see this if you open Tools > Error Console and scroll to the end of the long list after clicking the link to start the game.
    If you think the developers of this site might be willing to update the game, let them know about this problem.
    If not, and the game is very important to you, you could try Chris Pederick's User Agent Switcher extension (Tools > Add-ons > Get Add-ons) to make Firefox temporarily masquerade as an old version of Internet Explorer. There's no guarantee that will make the game work in Firefox, but it has a better chance than what you get now.

  • Why this program don't work without the "stop"?

    can you tell me why this program don't work without "stop"?and why the "stop" of my program can not work?
    Attachments:
    N(%}QA2R@SOLAF_12~0SQ)A.jpg ‏67 KB

    Crossrulz, sometimes you can snip the URL of the image:
    http://forums.ni.com/ni/attachments/ni/170/823066/1/
    The stop button is checked once in every iteration of the while loop, which includes waiting for the for loop to complete its 9 iteration.
    The for loop takes 9 seconds to complete because of the time delay, therefore clicking the stop button can take upto 18 seconds, depending on whether the button has been read yet.
    Turn on the highlight execution )light bulb icon) to see what is happening in your code
    - Cheers, Ed

Maybe you are looking for

  • How to change the default JRE when there are several version of JRE in Sys

    How to change the default JRE when there are several version of JRE in System? i have installed j2sdk1.5.0 then installed j2ee1.4,then installed Weblogic6.1 which use jdk1.3 Now the JRE is jdk1.3\bin When run class that was compiled with jdk1.5,throw

  • Numeric Value error 1426

    Hi, How to retrive the value of below query. I am encountered with numeric value error. select power(10,333333333333) from dual;Thanks in advance

  • MV45AFZB, USER_EXIT_CHECK_VBEP?

    Hi, If I give an error message in the screen of SCHEDULE LINES: FORM USEREXIT_CHECK_VBEP USING US_DIALOG.             MESSAGE e000(fb) WITH 'Error, not a multiple of' marc-ZZPLMNG. I don't see the message in SCHEDULE LINES screen, but in the previous

  • Multichannel Audio Export directly out of Premiere

    So, exporting a quicktime with 8 tracks of discrete audio is critical to my workflow. In FCP7, this was a tedioius process. In Premiere Pro CC, I have figured out the correct workflow, and sad to say, it really hasn't gotten any easier. But I have co

  • This could be a challenging one..

    Hi, I was wondering are there is anyways to "emulate" an external website on a full-flash interface. I know this sounds kinda weired... Here is what I mean by "emulate:" Imagine a html website that is bisected into two frames; one can put an <a href>