Returning Query Results To Presentation Layer?
Mar 11, 2010
Im currently working on an n-layer application that does alot of database work.90% of all database queries are updates, and inserts and I want to be able to view the results of my query in the presentation layer.I was thinking of creating a QueryResult class that has a few properties like QuerySuccessful (boolean), Message (string) - holds success or error message, and optional field to hold any additional data that may need to be passed back to the presentation layer.So I guess my question is, am I going about this the correct way by creating a QueryResult class, and passing that back up through the layers to my PL?
View 2 Replies
ADVERTISEMENT
Feb 7, 2011
I am generally following this tutorial, the main differences being I'm using 2008 R2 Express and Windows Forms, he is using 2005 & ASP.NET Web Site:'m building a minimalist Windows Form project for learning purposes. So I'm using a 1-table database with 2 columns, ContactID & Name. I added a dataset file, 'ContactsDataSet.xsd' to my project and added a single minimalist table adapter with just a fill() & getdata() method.Then I added a DataGridView control and connected it to the ContactsDataSet to confirm it was working and that worked fine. I ran it and it filled up with data as expected. Everything up to this point was auto-generated code.
View 4 Replies
Sep 10, 2010
I've been working to refactor my code and ended up with a quite clean main BLL class that has only a few manager classes that pass information between eachother. They handle separate tasks/areas like socket connection, data, etc. It's only one instance of each of these manager objects, so I believe maybe the base layout is a structural singleton (?) ..but not sure. This seems to give quite good oversight and a clean separation of PL/BLL as the main form only access the BLL through one instance of a single class. But now I'm trying to figure out how to lay out the presentation layer. So with this I would like to understand a few points: Do you have all controls as members of the form class, or can you make sub classes where some controls only exist on lower levels? Like for example if you have a tab where all controls only interact with each other, and not the rest of the form, would it then be possible to make this a separate class that holds both controls and additional logic ? The first problem I get when trying this is with the events, as if I simply move an event handler method to another class than the form class, I get the message: Handles clause requires a WithEvents variable defined in the containing type or one of its base types.What does this mean? and is there an easy way around this? I would like to understand how a slightly more complex PL is designed, so I know what direction to move in for studying/developing this.
View 3 Replies
Mar 5, 2011
I have a query using LINQ-to-SQL. It queries an underlying database table Rooms. It uses Where conditions to narrow down the results, namely:
Gender.Current Occupancy < Max Occupancy Available Flag is Checked I know this should return results but it keeps returning an empty set.Code is below
[code]...
UPDATE: I've verified that the issue is with the statement where sh.is_available = 1, which doesn't make sense since this is a bit field.
View 3 Replies
Jul 20, 2011
I'm doing some XLINQ in VB for work. I basically need to pull some values from a small chunk of XML as listed here:
<?xml version="1.0" encoding="utf-8"?>
<Fields>
<typeQtyRadioButtonList>1</typeQtyRadioButtonList>
<cmbQtyCheck>Reject</cmbQtyCheck>
[code]....
... Leaving out the implementation of the For Each loop....So I have stuck a break point on the for each and the collection has no elements in it.
View 1 Replies
Dec 1, 2009
I am accessing active directory with the System.DirectoryServices library, currently in my web layer. However, I'm trying to move a function from a code-behind file to a VB class in another namespace, and I cannot seem to access that class from within that namespace.
View 1 Replies
Nov 17, 2010
We are noticing this occurs BOTH in javascript and in VB.net 2.0. So basically both in server side and client side code. Basically if you run this equation 975328 - 153279.43 you get the following answer 822048.57000000007. However, if you run 975328 - 153279.4, 975328 - 153279.433, or 975328 - 153279.5 everything is returned correctly. WHY the system calcuates the 975328 - 153279.43 with an answer with 11 decimal places? Not to mention adding the 7 in the 11th decimal place, thus making the equation answer incorrect.Of course I know I can trim, set the answer to appropiate decimal places, etc., etc.the above is proven by just entering the equation into the immidiate window, thus ellimnating varibables such as object types, etc., etc.
View 3 Replies
Mar 3, 2010
So, I'm not really sure if I have this setup properly or not. This is my first attempt at utilizing LINQ and I am trying to return data directly from an XML file.Here is my XML structure:
<folder_list>
<folder lbl="_localhost" abs="C:\_localhostapache2triadhtdocs" unc="C:\_localhostapache2triadhtdocs" tag="default" />
<folder lbl="Programming" abs="D:\_prog" unc="D:\_prog" tag="default" />
<folder lbl="Anime" abs="D:Anime" unc="D:Anime" tag="default" />
[Code]...
View 9 Replies
May 18, 2010
I have been having an issue with returning records from a SQLServer database where the date the record was created is between 2 user specified dates. When I populate the DataGridView with the results, they are incorrect and do not follow any recognisable pattern.
For example, if I specify the dates 05/05/2010 and 12/05/2010 I get the attached data in the DataGridView.
Code:
Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGo.Click
'Clear the DataGridView
[Code].....
View 3 Replies
Mar 5, 2011
I am pulling a date value from my database:
Dim qfresho = From p In dbConfig.Configs _
Where p.Description = "FROD" _
Select p.dateValue
Dim qfreshc = From p In dbConfig.Configs _
Where p.Description = "FRCD" _
Select p.dateValue
Then comparing these date values to the current date:
[Code] .....
But for some reason its always returning the Else condition - even though the values in the database should make the query true. I'm guessing for some reason its not pulling the results as a date?
View 3 Replies
Apr 5, 2011
I have a GridView which is showing results and from which I am deleting a result using the auto-created delete link. My code behind to remove the row and associated info. is:
Private Sub GridView1_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GridView1.RowDeleting
' The deletion of the individual row is automatically handled by the GridView.
Dim dbDelete As New pbu_housingEntities
' Remove individual from the bed.
[Code] .....
It seems that it is not able to grab the row that is being deleted, so it is always giving me a "Object reference not set to an instance of an object" error.
View 1 Replies
May 7, 2012
like an Interop user control (VB.NET) to return and to accept multiple values from a get/set call. I assumed a user defined type (UDT), would be the correct way but I keep getting a "Variable uses an Automation type not supported in Visual Basic¯ from the VB6 compile. How is passing multiple values between an interop control and the VB6 application done?VB.NET (Interop) code, a control with a .NET ListView
Structure Employee
Dim Firstname As String
Dim Lastname As String
[code].....
View 2 Replies
Mar 30, 2009
I have a problem which I have tried to solve in several ways, and by searching the Internet for various terms, searching through books and Visual Basic instructional videos, but none have yielded the correct results. My goal is as follows:
1. Create a Database listing job names, job numbers, and a link to the file about the job.
2. Create a form with 2 text boxes, a search button, a box to display results, and a preview panel.
The two above steps have been completed. The following is where I get stuck
3. I want to search for either the job name, and/or the job number, have VB search through the database and return the results in the results box.
4. On clicking on one of the results in the result box, the preview panel will show a preview of the file.
Notes:
i) The files being linked top are Microsoft Excel files.
ii) The box I have used for the results currently is a listbox, though I've no idea if this is the correct choice for what I want to do.
iii) The database I created is an *.xml database created in Visual Basic. I am a fair beginner to VB, learning as I go, but I'm stumped as to how to achieve this so any pointers on how to achieve points 3 or 4
View 2 Replies
Nov 25, 2011
I have been taking a class in Visual Basic and am currently working on my final project which I am having some trouble with. I am using Visual Basic 2010 express The project is to create an application that will store data in a text file, specifically, Last Name, First Name, Customer Number, Address, City, State, ZIP Code, Telephone Number, Account Balance, and Date of Last Payment. I have gotten everything done except the ability to search the file by Last Name or Customer Number. I have no idea how to go about this? I was thinking of ways to use indexof or Readline to be able to search the data, but I'm not familiar enough with the code to come up with a good solution. Below is a picture of how my form looks..As you can see, I'm currently using 2 separate forms to get the data from the user. Here is the code for Form1 which is the "Customer Accounts" form in the picture.
Imports System.IO
Public Class Form1
Public customerFile As StreamWriter ' Object variable
Public customerFile1 As StreamReader ' Object variable
Public strFile As String
[Code]...
There isn't enough room to post the code for my secondary form, but you get the idea. I would like to be able to enter a search term in the textbox on the bottom right of the form, and either search the data as its displayed in the listbox, or search the actual file? I was thinking that the results would be displayed in a messagebox?
View 3 Replies
Mar 11, 2010
how to take a query that returns a single row of data and load that data into textbox controls.I know about ExecuteScalar but it is only good for a single column of data from the query.
View 2 Replies
Nov 30, 2010
I am working in VB.NET defining my own classes. I have 5 classes, Policy, Coverage, CoverageCollection, Layer, and LayerCollection. Policy has a bunch of data items, one of which is of type CoverageCollection. Coverage has a bunch of data items, one of which is of type LayerCollection.
Policy
private id as Long
private name as String[code].....
Then I do like "dim p as Policy". So, iIn order to get to properties on a Layer, I reference it like p.cov(0).lyr(0).face. What I am trying to do is add a readonly property to Layer that is calculated using some Layer information but also using something from Coverage (or even Policy). I can take this in as a parameter to the property, but I think there should be a way to get at Coverage/Policy information since I am "under" it already. Is there a way to do this?
View 1 Replies
Feb 23, 2011
I have a Search web reference (from a Search Server 2010 express install) in a vb.net application that is utilizing the QueryService Class to search a production Sharepoint foundation 2010 site.At a previous point in time, we had created a proof of concept on an entirely test system that has since been turfed. From my recollection on this test system when documents were uploaded as a specific site content type (that inherits from document) and metadata was provided, we could search for specific metadata by making managed properties for each, and search results would be returned as documents (with the isdocument flag set to true). Viewing the document then became simple, as we could simply use the filename and path to display the stored file.Now we are developing a production system and we have encountered a new behavior, where these results now are returned as aspx results such as
[URL]
This of course makes it terribly difficult to locate and view the document, we can extract the Title which will then give us the name of the file with no extension, but that hardly helps, as the FileExtension data is aspx, not the documents file extension, so we don't have a full filename. We could display the page returned as a result, but would much prefer the document itself.
I've made a test document library, with just bare bones setup, (not using the site content type, or site columns) and uploaded some documents on the same site, and they are returned in the same fashion, so I don't believe the document library, or content type are the issue.
With a fairly limited understanding of both Sharepoint and Search Server, I don't know if this is a setup issue with the search service itself, with the site configuration, or with the querypacket I am sending. We also have a third party application (Knowledgelake) installed on the server that ties into sharepoint which could have changed configuration somewhere as well?
I don't think the query packet has changed since it was working in the proof of concept, other than the custom data column names. I will provide it here in case there is something glaringly obvious to an external reader.
<QueryPacket xmlns='urn:Microsoft.Search.Query.Document'>"
<Query>
<SupportedFormats>
<Format>urn:Microsoft.Search.Response</Format>
[code]....
View 1 Replies
Mar 15, 2012
I am messed up with the below query[code]...
but when i run the query in my project the reader in not reading correctly...even if values are present is returns false and if values are not there then it returns true.
View 10 Replies
Apr 25, 2009
I'm trying to query a remote machine and get the cpu percentage similar to task manager.. I have the following code:
Code:
im wmiK As New WMI
Private objMgmt As ManagementObject
[code].....
View 10 Replies
Jan 22, 2010
I have the follow Linq query that is in a web application that was converted from .NET 1.1 to 3.5:
dim objListOfFilteredDataRows = from datarows as datarow in objDataSet.tables(0).rows _
where datarows("SomeColumn") = SomeValue
I have the exact same query in an application that was created using .NET 3.5 and the query returns an IEnumerable. However the query in the converted application is returning:
{Name = "WhereEnumerableIterator`1" FullName = "System.Linq.Enumerable+WhereEnumerableIterator`1[[System.Data.DataRow, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"}
**Edit: When I highlight the expression, the intellisense says that it doesn't know the type of objListOfFilteredDataRows and assumes its a type of "Object". Why is the type not infered in the converted 1.1 application but is infered in the "native" 3.5?**
What am I missing here? How do I convert the "WhereEnumeratorIterator`1 to an IEnumerable?
View 5 Replies
Apr 28, 2011
Just a quick question about LINQ, I want to use a value from the returned dataset to lookup a value and return this. The line I am struggling with is .ViewingNotes = NewViewing(pt.ProspectId).GetViewings().Columns(7).ToString(). Is this possible?
With BusinessLayerObjectManager.Context
Return (From p As [Property] In .PropertySet
Join pt As Prospect In .Prospects On pt.Property.propertyID Equals p.propertyID
[code].....
View 1 Replies
Jul 26, 2011
I'm trying to run a query from a search form by date and I'm receiving the following error:[Teradata Database] Partial string matching requires character operands.The code for the search is:
ElseIf OptDate.Checked = True Then
sSQL &= "DATE_SUBMIT Like ('" & txtDateRec1.Text & "%')"
End If
View 1 Replies
Oct 28, 2010
I am trying to debug my code, which involves a simple webservice that passes parameters to a data class, which calls a stored proc, and returns one row of record. I am not getting any error messages, but I am not getting any records back either.[code]
View 1 Replies
Jun 11, 2011
I am developing an application that based on when a user has last entered a payroll, my program tells them the next available Sunday that is available to them based on
1. The date that the last time payroll was entered
2. If payroll ran = "yes" or "no"
I have a sql query that returns the next Sunday back to me based on this criteria, but when I put it into my application, it returns 1/1/0001 to me.
Here is the query:
select MAX(payrolldate) AS [payrolldate],
dateadd(dd, ((datediff(dd, '17530107', MAX(payrolldate))/7)*7)+7, '17530107') AS [Sunday]
from payroll
[Code].....
View 2 Replies
Oct 26, 2010
I am building an application where a button click runs a sql query and shows a user the next available date that they can process from. The problem was that it needed to be the following Sunday and not the following day.
That code looked like this:
Public Class Form1
Dim ReturnValue As Object = Nothing
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
[Code]....
View 1 Replies
Oct 27, 2010
I am building an application where a button click runs a sql query and shows a user the next available date that they can process from. The problem was that it needed to be the following Sunday and not the following day.That code looked like this:
Public Class Form1
Dim ReturnValue As Object = Nothing
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim connectionString As String
[code]....
View 5 Replies
Oct 21, 2008
I am building an application where a button click runs a sql query and shows a user the next available date that they can process from. The problem was that it needed to be the following Sunday and not the following day. That code looked like this:
Code:
Public Class Form1
Dim ReturnValue As Object = Nothing
[code]....
Code:"select payrolldate from payroll where(payrolldate <= getdate())and payrollran <> 'yes'")but when I add that query it just returns a value of 1/1/000 as the date.
View 1 Replies
Jan 4, 2011
I have a view on some data in my database it returns the data as I would expect, for example
Call Date To From Phone Number
20/1/2010 00:00 23:59 08923233223
20/1/2010 00:00 23:59 08923233245
However when I have added this to my Entity Model and query it I get duplicate(and unexpected) data appearing
Call Date To From Phone Number
20/1/2010 00:00 23:59 08923233223
20/1/2010 00:00 23:59 08923233223
I am simply binding a Entity Data Source to this Entity but I am left scratching my head as to why the data is being returned differently
EDIT: Interestingly this can't be the result of some strange under the hood join as the row counts match as expected. I have also put together a query myself to test with the same odd results.From o In App.Entities.v_PersonalRules Where o.companyid = CompanyID Select o. I am using Visual Studio 2010, .NET 4
EDIT: The front end code is fairly simple
<asp:EntityDataSource ID="EDS_Personal" runat="server" ConnectionString="name=Entities_NEW"
DefaultContainerName="Entities_NEW" EnableDelete="True" EnableInsert="False"
EnableUpdate="True" EntitySetName="v_PersonalRules" EntityTypeFilter="v_PersonalRules" >[code]....
View 2 Replies
Mar 8, 2010
I have got an xml document which looks something like this.
<Root>
<Info>
</Info>
<Info>
[Code]...
How can i write a linqToXML query so that it returns me an IEnumerable containing each child element, in this case all five child elements of , so that i could iterate over them. The order of child elements is not definite, neither is number of times the may appear.
View 1 Replies
Jun 29, 2010
In my code I enter a string in a text box and have the query check the server for the entry. If it exists it returns the string and the date into two separate variables. The database only has TrackingNumber and Date. Below is the code. As of right now i get "Invalid attempt to read when no data is present." at the "If (sdr("TrackingNumber") IsNot Nothing) Then" line.
Public Function CreateSqlParameter(ByVal name As String, ByVal dbType As DbType, ByVal direction As ParameterDirection, ByVal value As Object) As SqlParameter
Dim parameter As SqlParameter = New SqlParameter()
[Code]....
View 3 Replies