DISTINCT Output From Multi-Columns?
Aug 4, 2010
I'm trying to fill a ComboBox from 3 columns in the same table. I need output DISTINCT and the drop down box would look better if it had no spaces between groups.
Using myCommand As New MySql.Data.MySqlClient.MySqlCommand("SELECT ten_id1, ten_id2, ten_id3 FROM tenants", myTenConnection)
Dim myReader As MySql.Data.MySqlClient.MySqlDataReader
[Code].....
View 2 Replies
ADVERTISEMENT
Jul 13, 2010
I am trying to distinct on multiple columns and get datarows from datatable. but getting error.
Dim query As IEnumerable(Of DataRow) =
(From row As DataRow In SourceTable.AsEnumerable() _
Select row.Field(Of String)("ColumnName1"),
[Code]....
I want another datatable with distinct row based on given columns from SourceTable.
View 3 Replies
Oct 25, 2011
I have a three column table which lists every person, every event they may have attended, and what percentage of the time they were there. I would really like to display this on one page with the person names on the side and the event names across the top.
Here' an example of what I have:
NAME EVENT %ATTENDANCE
Smith Rock Climbing 50
Allen Rock Climbing 78
[Code]....
View 2 Replies
Nov 4, 2010
The following data is created by joining two sql tables together:I would like to group together distinct rows of DateStamp/UserName/ StudentName/ InstructorName/TableName/PrimaryKey (I'll call this 'group records') and then group under these ColumnName/PreviousValue/NewValue (I'll call this 'subgroup records')The end result would be that I could iterate through the 'group records' - there would be 5. In each 'group record', I could then iterate through the 'subgroup records'. The 5 groups would contain 3, 2, 5, 2 and 1 subgroup records respectively.What would be the syntax to create a query to do this? Ideally this would be in a vb.net linq syntax.
View 1 Replies
Aug 9, 2010
I have the following table structure. I want to select distinct CustomerId and CustomerName, TotalCost.[code]
View 2 Replies
Apr 16, 2010
basically i'm trying to reproduce the following mssql query as LINQ
SELECT DISTINCT [TABLENAME], [COLUMNNAME] FROM [DATATABLE]
the closest i've got is
Dim query = (From row As DataRow In ds.Tables("DATATABLE").Rows _
Select row("COLUMNNAME") ,row("TABLENAME").Distinct
when i do the above i get the error
Range variable name can be inferred only from a simple or qualified name with no arguments.
i was sort of expecting it to return a collection that i could then iterate through and perform actions for each entry. maybe a datarow collection?
As a complete LINQ newb, i'm not sure what i'm missing.
i've tried variations on
Select new with { row("COLUMNNAME") ,row("TABLENAME")}
and get:
Anonymous type member name can be inferred only from a simple or qualified name with no arguments.
to get around this i've tried
Dim query = From r In ds.Tables("DATATABLE").AsEnumerable _
Select New String(1) {r("TABLENAME"), r("COLUMNNAME")} Distinct
however it doesn't seem to be doing the distinct thing properly.
View 3 Replies
Mar 9, 2012
I have a datatable as shown in the figure. Let me explain my required based on this image. I have 7 rows of data. The rows 1 and 2 contains columns till UnitSqcNo same. I want only row 3 among the two. In general I want select all the rows with distinct model, unittype, unit and rest with greater CompId. ie the table should look like
View 1 Replies
Aug 3, 2010
I am continuing a previous thread to keep it from becoming tooooooo long. I tried most of the helpful suggestions offered by kind forum contributors but can't seem to make them work. I tried to analyze somewhat but it's beyond my skill level. So a different approach was to try to incorporate the code in the PrintDocument1_PrintPage event of my application that prints acceptably, but only prints first page of multi page document. I had three somewhat different approaches offered by John Anthony Oliver, ACAMAR, and Crazy Pennie. I cut the code and placed in the PrintDocument1_PrintPage event code. All three approaches made the "Printing"message box page counter go wild without outputing to my printer. Family Man Mike suggested resetting the variables after the e.HasMorePages=false line. I tried that approach but couldn't make that work for me, I really don't comprehend but made an attempt such as num_of_pages = 0, startVal = 0, endVal = 0. That had no affect on the functionality.
Public Sub DrawStringRectangleFormat _
(ByVal stringToDraw As String, _
ByVal stringFont As Font, _
ByVal stringFrmt As StringFormat, _
[code].....
View 1 Replies
Feb 20, 2009
I am currently using the following code to store all of the items from a listbox control in an array, and then build a string based on the array items, trimming the last two character of the string to remove the ", ". I am looking to do something similiar for my multicolumn listview control but am concerned about how to store the multiple subitems for each item in the array.
Dim myStr (listbox1.items.count) as String
'store all active medications information in an array & build a string
For i As Integer = 0 To listbox1.Items.Count - 1
[code].....
View 2 Replies
Feb 28, 2010
So what happens is. I have this JAVA Code which i am making out of a vb form to help me develop quicker in that. So, when i click "Button1" a formula enhances and gives an output "TEXT" Which i want to choose what lines it shows on my "MultiLine Textbox".
Basically, How do i make it so when i click a BUTTON a text is written in a MULTILINE-TEXTBOX which i get to choose which bits of the text goes on which line.
the example is:
("this goes on line 1")
("this goes on line 2") ect.
View 4 Replies
Aug 19, 2011
I got a very simple question regarding resizing listview columns. I have a form with a listview anchored to it (top, bottom, left, right). The form is resizable and the user will be able to resize the listview columns manually. However, I need the listview to resize its columns automatically when the form is resized (especially when its maximized).
But, I don't want all the columns to resize, only the ones I choose. For example, the listview will have 6 columns in total (0-5). When the user resizes or maximizes the window, I need only columns 2 and 4 (or columns 3 and 5 or columns 1 and 5) to resize. Now, I have come up with two pieces of code as listed below.
Code Part A: The following code only resizes one column. When the form is maximized, only the column ID provided will resize and fill the rest of the control. It works perfectly but I need to be able to resize multiple columns (as explained above):
Public Sub lvResizeSingleCol(ByVal resizeColumn As Integer, ByVal listViewName As ListView)
Dim w As Integer = 0
For column As Integer = 0 To listViewName.Columns.Count - 1
If column <> resizeColumn Then
w += listViewName.Columns(column).Width
[Code] .....
View 2 Replies
Nov 18, 2009
Im wondering how would i display the dropped items directory and icon in columns.
View 3 Replies
May 13, 2010
I am trying to calculate two columns in a DataGridView. The first column is the points column and the second column is the Rental_charge column. I would like one text box to display the total of points and the second text box to display the total Rental_charge.
Private
Sub Rental_ItemDataGridView_CellEndEdit(ByVal
sender As
Object,
[code]....
View 1 Replies
Aug 19, 2010
how to redirect outputs from console to a window form text box,but the console application I'm using is always running real time, thus my .net application hangs until I close the program that is read real time.The code displays the application to a 2nd form with a textbox multi line. Until I close that my entire program hangs and the console application monitored runs.
How do I code it to:
1. Run real time without hanging the entire program.
2. the console app must run at all times. (figured how to hide/ and no window created for it)
Sub Console()
Form2.Show()
Dim myCon As New Process
myCon.StartInfo.UseShellExecute = False
[code].....
View 6 Replies
Feb 10, 2010
I'm adding multi-threading facilities for the first time. I have a function that is wrapped to be run in a separated thread. This function retrieves data (text) from a combobox and it works for sure without multi-threading.
When I call it as multi-threaded, I get the following error when I try to retrieve the data from the cmobobox: Cross-thread operation not valid: Control 'cmb1stBL' accessed from a thread other than the thread it was created on.
It looks like a restriction of thread-safety... I assume that the child thread cannot read from his parent, to make sure that he doesn't change his parent data. So how can I read the data from the combobox? Should I read the comoboxbox data before calling the child thread?
View 4 Replies
May 14, 2011
I have a need to build an app that will access about 10 websites and pass data to them, etc.I've read about something called multi-threading when searching Google. I've also seen people say that they use multiple browsers.Which route is better to use? I figure if you have to do some sort of multi-threading that you would access a single browser?
View 2 Replies
Mar 1, 2012
What I am trying to do: There are three powershell scripts with different time delays as shown below.I am trying to run them asynchronously in .NET and I followed this article to implement Asyncrhonous programming. Where I am stuck:The I am not able to retrieve output after the events are invoked.The scripts are being called but then the program ends and it shows "Press any key to continue" in console windows.I don't what I am missing here.
Info: JobRequest is a class that I use to pass around information keep track of jobs.
Sub Main()
OurAsyncFunctionCalling("psDelayScript2.ps1", "-arg1 4 -arg2 5", 1)
OurAsyncFunctionCalling("psDelayScript1.ps1", "-arg1 2 -arg2 3", 2)[code]......
View 1 Replies
Oct 26, 2011
I'm using VB.net 2005. I have working programs that I populate DataGridViews with something like the following:
[Code]...
View 6 Replies
Nov 30, 2010
My goal is to connect to my database either manually or using an sqladapater, and get information from two of my databases on sql server 2005. Then I want to take this information and on run-time begin to add/subtract/divide/multiply certain columns and place the information into other columns. I can do this in queries, however, I want to do it on run-time what is the best way to achieve this.I had some of this working, but I just want to start fresh and see how you would go about doing this.
[Code]...
View 2 Replies
May 14, 2011
i have one project with multiples web services so i created various singleton class thinking in
performance. now i think create one singleton class and that have the instances of my webservices
[code...]
View 1 Replies
May 14, 2011
I have a need to build an app that will access about 10 websites and pass data to them, etc.I've read about something called multi-threading when searching Google. I've also seen people say that they use multiple browsers.Which route is better to use? I figure if you have to do some sort of multi-threading that you would access a single browser?Not sure which way I should approach this app.
View 2 Replies
Sep 25, 2011
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Microsoft.VisualBasic.Interaction.Beep()
System.Diagnostics.Debug.WriteLine(3 + 2)
End Sub
Why I don't see in Output window number 5 as output?
View 4 Replies
Jun 29, 2011
I have the below Linq query that is returning the data but I need to aggregate the columns to group on the Period and Sum the Count columns. How do I go about doing this?
LINQ
from t In tblTimes
join h In tblEngineeringDashboard_CADMachinesCounts on t.ID Equals h.TimeID
Order By t.Period
[code].....
View 1 Replies
Oct 15, 2009
I am using the following code to alter an table imported from an Excel spreadsheet
Dim SQL As String = "ALTER TABLE receipts ADD payee integer, account integer, category integer, reconciled boolean"
Dim dataread As New OleDb.OleDbCommand()
dataread.Connection = Connection1
[code]....
Both ExecuteNonQuery() actions yields the exception message {"Syntax error in field definition."}The error message does not happen with the first if the boolean column is not there (I tried Tes/No as a definition - but that also failed.The second query to modify the ID column from autonumber to integer I assume fails because it is a Primary KeyHas?
View 1 Replies
May 23, 2011
Imagine the following scene: I have one table which have tree columns (ID, Number, Name).
A Select query result on this:
code:
Now, the user deletes the Number 3 and 4. So, now the Select query is going to be:
code:
And I want to have:
code:
How can I organize the column?
View 14 Replies
Feb 21, 2011
I've the following code which successfully makes an average for all the columns from a table. What I need to do though is ignore certain columns in this equation.
Dim totalNumber as Double = 0
Dim count as Integer = 0
For x = 0 To xyz123.Tables(0).Columns.Count - 1
[Code]....
View 2 Replies
Feb 28, 2010
Averaging columns in a table - ignoring certain columns
View 2 Replies
Feb 18, 2010
What should I use and how to use something that functions like a label box but can handle several columns and columns? Something that looks like this. [code] Name | Age | Birthday are headers and the letters are variables
View 5 Replies
Jun 14, 2012
I'm just going to throw all my code in here in case there's something wrong with a piece of the code not in the "SelectName()" sub.
Module Module1
Dim selectednames As String = ""
Dim index As Short = 0
Dim inarray As Boolean = False
[code]....
Here's an image of what it does (I suppose you can see what went wrong)13 inputs, 3 outputs expected, only 1 output given.As from what I've figured out so far, it's doing the correct amount of loops etc. It's just as soon as it starts generating the "winner" for the 2nd game key it doesn't get a string value from namesarray.Also, why is
For x = 0 To totalnames - 1
Debug.Print("namesarray(" & x & ") = " & namesarray(x))
Next
not giving me a debug output?
View 2 Replies
Apr 15, 2009
I'm having some trouble extracting a distinct value out of a dataset.. I have a database table with 5 fields,
ProjectName, VendorName, ExpenseType; TxnDate; Amount
In VB6 I would have several different recordsets opened one after another to
A. Find all the unique project names within the table (and put them into a For/Next loop)
B. For each unique project name open a recordset to look up unique vendor names applicable to it (add For/Next)
C. For each unique projname, unique vend combination find unique exptype....for next loop....
D. For each unique projname, vendor name, exptype, date combination, sum up the dollar amounts...
The end effect is that you have a net dollar amount for each unique combination of project/vendor/expensetype/date.I dont like doing it like this because I have to keep hitting the database, I wanted to know if there was something I could do within the actual dataset which will be filled when I open the application with the values of the entire table..I got to ds.tables("Text").select.distinct( ....not sure how to proceed and everthing I've read online leads me into a complicated direction of creating new datatables...
View 1 Replies