Handling Long Strings - Change The Query / Structure And Test It?

Jul 9, 2010

I develop in VB and often I'm writing long TSQL statements in SSMS but getting them into VB is a bit of a pain. I like SSMS during development because I can change the query / structure and test it when there are problems. Some of them become stored proceduresand some of them I just keep in the code.

I like keeping them in the code because when I have a problem with something, I can GREP my projects directory and find the code that does something (that I've forgotten) or someone asks something about how something works, I can look it up. I've yet to find a GREP for stored procedures. Is there such a thing?I've read in a "best practices" white paper how we're not supposed to concatenate super long strings with & _

[code]...

C# handles these things much better than VB. I'm wondering how I can keep my code together during development and searchable later. I had my hopes up when VS 2010 offered implicit line continuation, that this would help my multi line SQL procedures.Again, I was mistaken. Perhaps I could write it all on one line. I'd be interested in knowing if there's a feature that I am not aware of. Well there are certainly many features which I'm not aware of, but I was referring to "long strings".

View 2 Replies


ADVERTISEMENT

Handling Long Strings In VB?

Dec 21, 2011

I develop in VB and often I'm writing long TSQL statements in SSMS but getting them into VB is a bit of a pain. I like SSMS during development because I can change the query / structure and test it when there are problems. Some of them become stored procedures and some of them I just keep in the code.I like keeping them in the code because when I have a problem with something, I can GREP my projects directory and find the code that does something (that I've forgotten) or someone asks something about how something works, I can look it up. I've yet to find a GREP for stored procedures. Is there such a thing?I've read in a "best practices" white paper how we're not supposed to concatenate super long strings with & _ but a hundred line proceure is a pain to nest in

sb.AppendLine(" WHERE [q3] IS NULL "
sb.AppendLine(" AND [q4] > 2
"

[code]....

C# handles these things much better than VB. I'm wondering how I can keep my code together during development and searchable later. I had my hopes up when VS 2010 offered implicit line continuation, that this would help my multi line SQL procedures. Again, I was mistaken. Perhaps I could write it all on one line. I'd be interested in knowing if there's a feature that I am not aware of. Well there are certainly many features which I'm not aware of, but I was referring to "long strings".

View 1 Replies

Handling Long Running Webrequest?

Jun 29, 2009

I have a web request that can take 30-90 seconds to complete in some cases(most of the time it completed in 2-3). Currently, the software looks like it has hung if the request takes this long. I was thinking that I could use background worker to process the webrequest in a separate thread. However, The software must wait on the request to process before continuing. I know how to setup the background worker. What I am unsure about is how to handle waiting on the request to process.Do I need to create a timer to check for the results until the request times out or is processed?

View 1 Replies

.net - Grouping Methods In Test Structure Of Nunit Gui

Jan 26, 2011

Currently I have nunit's gui Test Structure setup to use Automatic Namespace suites.I was wondering if it was possible to group up method names inside the TestFixture.At the moment, the tree looks like

[code]...

View 2 Replies

Error Handling & Copying Folder Structure?

May 2, 2011

Below is a tiny program I modified from an example Microsoft code tutorial. This program simply copies .flac and .mp3 files from one specified folder to another, and if the file is already there it simply does not copy the file. I would like to make 2 changes to the program:

How would I go about making the error handling work (i.e. not crashing the program when an invalid input is made)?Also, a big change I would like to make would be for it to copy the folder structure and all files in the original folder (At the moment, it only copies files that are directly in the original folder, not files that are in folders inside the original folder).

[Code]...

View 2 Replies

.net - Handling Error Strings?

Aug 14, 2009

In my vb.net application if I have a known set of Error Strings i.e.

Failed because I don't know about it
Failed because I know about it but I can't find it
Failed for another reason

[code].....

View 6 Replies

VS 2008 Handling Strings?

Apr 12, 2010

I once again feel so angry about VB .NET . Here's what ruined my day :Lets say we have have a string variable :

Dim Var1 As String = "blablabla"
If we want to replace something within it , we can use the Replace function :
Dim Var2 As String = Replace(Var1,"a","o")

This works great . My problem appears when I want to replace the " character (double quote) . Thus , when using :Dim Var2 As String = Replace(Var1,"""","o")it will return an error .Of course you may wonder why I care to replace the " character . You see this string variable receives its value from a text box . Thus , if the user uses the " character , I want to replace it with two ' characters (single quote) . Is this replacement possible in .NET

View 4 Replies

Structure To Hold 2 Strings?

Nov 29, 2011

I like to create a Structure that could hold 'Yes' or 'No' only; just like a Boolean variable could hold True or False.

View 12 Replies

Sql Server - Handling Null Strings When Concatenating Select Statement?

Nov 9, 2011

I have this simple-minded query:

select a.str_number+' '+a.str_name+' '+a.str_suffix+' '+a.str_apt AS addr from mytable

This query works as long as none of the concatenated values are not NULL. If any is null, the address does not show.

I tried this:

select IsNULL(a.str_number+' '+a.str_name+' '+a.str_suffix+' '+a.str_apt AS addr,'') from table

What I would like to accomplish is to replace NULL with empty space if the value is null but I still get no values.

View 3 Replies

Query Too Long In .NET 3.5 And SQL Compact 3.5?

Jul 26, 2009

In Visual Basic 2008 Express with SQL Server Compact 3.5 and the Usual DataSet / TableAdapters, My Query is too long:Changing the names, it is a query like this:

SELECT Table1.*, Table3.*
FROM Table1
INNER JOIN Table2
ON Table1.ID = Table2.T1ID

[code].....

Problem is, Table1 and Table3 have around 10 and 5 columns each, with rather descriptive names, and The Table adapter is insistent on writing all the columns out and therefore hacks off my command. (It won't take * 's, it always says it can't find the column Table1.* )

Is there a way around this?

View 2 Replies

SQL Query Where Clause Is Too Long

Feb 25, 2011

I've written an SQL query with a lot of 'or's in the 'where' clause: i.e. "SELECT * FROM myTable WHERE col1='a' or col1='b' or col1='c'...etc" I'm trying to run a query in access via vb.net, but I keep getting "Query is too complex" error message. I'm guessing I've hit some maximum limit. Anyone know a way around this, other than just to break it down into multiple queries?

View 5 Replies

Convert Forum Date And Time Strings To DateTime Structure?

Jun 7, 2011

Is there a framework class that converts the partial day strings on these forums to a DateTime? Examples are "a few seconds ago", "19 minutes ago" and 3" hours 26 minutes ago",

View 4 Replies

Handling NULL Result From Query

Dec 22, 2009

I have a sql query which is returning null value below is the section the iID is null.Once debugger reaches this it goes to exception as its result is NULL. How to control debugger from going to the exception.

[Code]...

View 2 Replies

Linq Query Handling Null Values?

Nov 12, 2011

From r In ReceiptLines
Where
r.RECEIPT.RECEIPTDATE >= _reportStartDate
And r.RECEIPT.RECEIPTDATE <= _reportEndDate

[Code].....

I am fetching all departments and their sales, average, count from the ReceiptLine, Receipt, ReceiptDiscount tables. The problem i am facing is, if i remove where discount > 0, I am getting null exception. But if I include that, then I only get sales that has discount. How would I write query that bring all sales less discount (if it has one).

View 2 Replies

VS 2010 - Handling Result Of Inner Join Query

Mar 25, 2011

I am using an Access database to store (filepaths to) pictures as well as comments people can leave on them. One picture can have multiple comments, so the tables look like this:
_____________ _____________
|Photos | |Comments |
|------------| |-------------|
|Id (PK) | |Id (PK) |
|PhotoPath | |PhotoId (FK) |
|Description | |Comment |
|____________| |_____________|

What I need to do now is retrieve a list of all Photos along with their Comments. So I have a class Photo with a collection of Comments:
vb.net
Public Class Photo
Public Property Id As Integer
Public Property PhotoPath As String
Public Property Description As String
Public Property Comments As List(Of Comment) End Class Public Class Comment
Public Property Id As Integer
Public Property PhotoId As Integer
Public Property Comment As String
End Class

I can retrieve the records using an INNER JOIN query (right?), as such;
SELECT Photos.*, Comments.*
FROM (Photos INNER JOIN Comments ON Photos.Id = Comments.PhotoId)

From the result of that, for each row in the result I can create a new Photo instance, set its properties and put it in a List(Of Photo) for further processing (displaying). However, how do I handle the Comments? With this query I would get a lot of duplicate Photos. I'd get a row for each comment, but most of these rows will represent the same photos... How do I handle this the best way? I have used inner join queries before, but only for a one-to-one relationship so I never had this problem before. Now when I finally need a one-to-many relationship I realize I've no idea how to handle this appropriately...

There must be some standard way of handling this? When I previously handled cases like this I didn't use an inner join, I just retrieved all Photos first, then iterate through them and run another query to retrieve the Comments that belong to that Photo (SELECT * FROM Comments WHERE PhotoId = ?). That works fine, but when the tables are getting larger it is getting noticeably slower. So I want to do it in a single query, I definitely want to avoid running hundreds of queries if I can.

View 5 Replies

Change Size Of Font When Too Long?

Apr 25, 2010

How can I automatically change the font size of the label when the length of text exceeds the maximum width of the label?

Also, how do I set when that should stop? I mean obviously it can't keep getting smaller forever, so what would you advise I do when the text gets to a really small size? Just stop text entry? How?

View 2 Replies

How To Change A Button's Image During A Long Process

May 29, 2009

I've got a common search button in my app that has the typical static magnifying image displayed on it. When the user clicks it I want the button's image to change to the animated search, to inform the user that the app is doing something (searching the database). Then when the search process is complete, change back to the static search image.

[code]...

When I comment out the line to change the button's image back to the static search image, (as stated above), and click the search button, the app actually performs the search, then when the search is completed, it changes the button's image.

Apparently VB or .Net is performing the under-the-hood process before the display/paint process, even though that's not the way it's coded. give me some insights on how to fix this, AND also please inform me of why this behavior occurs so I can try to avoid it in the future.

View 11 Replies

DB/Reporting :: Test A Number Of Stored Procedures Through SQL Server Query Analyzer?

Mar 17, 2008

I am trying to test a number of stored procedures through SQL Server Query Analyzer. But am stuck when I try to test stored procedures that contain Output parameters.

Code:
DECLARE @Counterbigint
DECLARE @GUIDuniqueidentifier
exec usp_tbl_User_Add @Counter, @GUID, 'UserName', 'First Name','Surname',

[Code]....

When I put the Select statement though in the 'usp_tbl_User_Add' stored procedure in works fine and gives me the correct values.

View 2 Replies

Query A DataTable - Change The Query At Runtime (ex. Changing The Customer Name)

Oct 15, 2011

I created a RDCL in the designer. I would like the User to Determine what is shown in the Report. How can I change the query at runtime? (ex. changing the customer Name)

This is the query that I have in the properties:

SELECT [Date], Address, Customer, Orders
FROM Report_qry
WHERE (Customer= 'JohnDoe')

View 5 Replies

Change The Type Of A Controls' Height From Integer To Long?

Nov 14, 2009

Is it possible to change the type of a controls' height from integer to long? I tried:

Panel2.Height = New Long

View 8 Replies

Change Only Month Name Programmatically In Datetimepicker Format Long Using 2010?

Oct 31, 2011

How To Change only Month Name programatically in datetimepicker Format Long using visual basic 2010 I am use a DateTimePicker in a form

"Monday, October 10, 2011"

Now I want to Change Only Month Name

Means "...day, September 10, 2011"

also i want to change only year "2011" to "2010" How I can Change it..?

View 6 Replies

ASP.NET Query Strings Doesn't Work

Jul 2, 2009

I got this code in order to build an url for the link using a querystring from the current page. The problem is.... It doens't work.

[Code]....

View 6 Replies

Change Structure Of Code?

Aug 27, 2010

How do I change the program path '"logic.txt", "G:"' in the code below to the OpenFileDialog.FileName? Cos when I tried it, I receive String conversion errors and I tried altering the codes but it didn't work out well. [code]...

View 1 Replies

C# :: Aggregate Or Join Strings In Linq To Sql Query (SQL Server)?

Aug 6, 2010

Given a table like

ID | Name | City
1 | X | Y
2 | Z | Y

[code].....

View 2 Replies

.net - Value Of 'String' Cannot Be Converted To Type 'T Generic Function For Getting Query Strings?

Jul 21, 2011

I've got this function:

Public Shared Function GetQueryStringValue(Of T As Structure)(ByVal queryStringVariable As String) As T
Dim queryStringObject As Nullable(Of T) = Nothing
If queryStringVariable <> Nothing Then
If HttpContext.Current.Request.QueryString(queryStringVariable) IsNot Nothing Then
queryStringObject = DirectCast(HttpContext.Current.Request.QueryString(queryStringVariable), T)
End If

[Code]...

View 2 Replies

VS 2008 - Run Function Or Sub At Structure Change

May 11, 2010

I have a question: How can I make a function or sub run inside a structure when a variable in this structure changes? As example I have this function:
Public Structure Texture
Sub New(ByVal TexturePath As String)
Me.Path = TexturePath
Me.Image = LoadImage(TexturePath)
End Sub
Public Path As String
Public Image As Image
End Structure

And somewhere this happens:
Dim t As New Texture("path ooldfilename.tga")
t.Path = "path o
ewfilename.tga"
I want it to automatically load the image when the "Path" variable changes. Is the only solution making an extra sub and run that? It would really decrease my code size if it changes on variable change.

View 3 Replies

Way To Concatenate List Of Strings Into A Comma-separated Strings, Where Strings Are Members Of An Object?

Oct 16, 2009

Say I have a List(Of Tag) with Tag being an object. One member of Tag, Tag.Description, is a string, and I want to make a comma-separated concatenation of the Description members.Is there an easier way to do this than to read the Description members into a List(Of String) and then use the Join function?

View 2 Replies

VS 2008 Way Of Coding In Stead Of Writting Long Long Paragraphs

Sep 18, 2011

Is there a easer way of coding in stead of wrighting long long paragraphs like this in one line [code]All of this is on one line and i got lots of info to put down.."The game will begin on your 16th birthday with your mother waking you up. Today you are to go to the castle for the first time. Leave your bed and open your dresser for a Strength Seed. "

View 2 Replies

Apply Change To Instance Of Structure Within Array?

Nov 5, 2011

So I have an array which holds instances of a structure. The structure contains various string properties.

I'm looking to modify each instance of a structure within this array by doing the following:

For Each stuInstance As StuInstance In arrStuInstances stuInstance.strCarName = "Benz"

But I found that this in fact fails to really change it permanently. If I do the following loops in the given order:For Each stuInstance As StuInstance In arrStuInstances

[Code]...

View 2 Replies

Structure Values Change In Multiple Places?

Mar 21, 2009

I have created two structures, one named "Product" and the other named "Item". These structures are quite similar but are at the same time quite different from each other. The structure definitions are as follows. Ultimately, I declare arrays in my containing class which access these structures as a type. Their declaration: "Products() as Product" and "Items() as Item". All has been fine and dandy until one day, I go to change the items Enabled() values, and something happens. Not only does it change the Items(index).Enabled(index) value, it does it on the corresponding Products(index).Enabled(index) value, even though it was never specified to do so. Also, nowhere in my coding have i defined this sort of thing to occur. It is rediculous, because I watch it happen. I turn on the watch window, and debug one step at a time, and every time, I watch the Item line step, I look down at the arrays of products and items, and both values have changed. How do I get this to stop, and only change the Item.Enable value??

<Serializable()> _
Public Structure Product
Public Name As String

[code]......

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved