DB/Reporting :: Select Stored To An Array?

Jun 3, 2009

Im new to database programming and was wondering if you can save a select statement to an array:I tried this but obviously wont work, does anyone have any ideas?

Code:
Public Sub store_select_star_to_array()
Dim myCommand

[code]......

View 2 Replies


ADVERTISEMENT

An Array Of Objects - An Entry Will Be Stored In Serialports(4), All Other Array Elements Will Be Blank?

Jun 1, 2009

I've come up with the following and it's partly working.

Public serial1, serial2, serial3, serial4, serial5 As SerialPort
Public serialports() As Object = New Object() {serial1, serial2, serial3, serial4, serial5}
dComPort = "COM4"[code]....

The above code works fine! But im having trouble trying to now retreive whats stored in the array.In the above example, an entry will be stored in serialports(4), all other array elements will be blank.If I do this it works.

MsgBox(serialports(4).PortName) ' this retuns the value COM4

But I'd like to loop though all array elements and print out ALL the PortNames, The below code doesnt work, I get an error Object variable or With block variable not set.

For i = 0 To serialports.Length - 1
MsgBox(serialports(i).portname)
Next

View 3 Replies

DB/Reporting :: Block Var In Stored Procedure

Jul 19, 2009

I am using a stored procedure to add simple data to my db. My problem is if I want to add multiple items at the same time, I find myself calling the sp over and over again. This seems as though it is not the right way. I want to be able to pass multiple values to my stored proc.

I want to add say a persons name. I would like to capture the data I need into a block var such as name(x) and pass that to my procedure and in my procedure write as many fields in as I need.

I have an sp that takes my var name and adds it to my table. I do not want to call this procedure 300 times if I want to add 300 names etc. I would like to pass the whole block name() and all 300 at a time and in my sp write each like

name(0)

then write

name(1)

View 4 Replies

DB/Reporting :: Crystal Reports Using A Stored Procedure

Mar 19, 2009

We connecting a stored procedure in a crystal report.

In the query analyzer we can call the SP with: execute test 'example'

If we run the crystal report we get the possibillity to fill in the parameter for this SP. The report looks fine but how can we send this parameter in the crystal report script??

View 3 Replies

DB/Reporting :: Stored Procedure OUTPUT To Variables?

Apr 26, 2010

I have been banging my head against a brick wall for 2 days on this one. Someone please help, I am sure I am doing something stupidly wrong.I have a stored procedure that accepts 2 inputs and has 4 outputs. The SP checks the users database against a given username and password.

[Code]...

View 3 Replies

DB/Reporting :: DataGridView Back To SQL Database Through Stored Procedure

Feb 18, 2009

I have an app written in vb2005 that allows users to search a sql database for a store name. Once a store is selected, it then presents the user with 12 different tabs, each with a DataGridView showing various bits of info about the store. It's a large and convoluted database, so I'm using stored proceedures to pull the data for each tab. Here's a sample of one of the subs that populates the tabs.[code...]

Now, this works just fine to populate the grids on the tabs, and the same code is copied into each of the subs that fill the grids (changing the stored proc, parameter and grid names, of course). The problem I'm having is how to move changes made to the data in the grid back into the database.

I have stored procs that do this (and the procs do work), I just can't seem to figure out how to trigger the stored proc when the user makes a change.

If it matters, there is only a grid on each tab, I did not use a binding source as I am trying to keep an abstraction layer between the data and the app. I did create a dataset, which is how I gain access to the stored procs, but I left the grids unbound and (as seen in my code) bind them at run time.

View 2 Replies

DB/Reporting :: Stored Procedure On An Oracle Database Called : GET_HVE_PACKAGE_VERSIONS

May 29, 2008

I have a stored procedure on an oracle database called : GET_HVE_PACKAGE_VERSIONS This basically calls versions of PLSQL packages as stores the versions into a table. I am having big problems trying to call this procedure. I have tried everything. I am currently able to create and update etc etc using the executeNonQuery method and I thought that I would be able to call a procedure them same way, obviously not

the whole project depends on me being able to call procedures against the database.

[Code]...

View 5 Replies

DB/Reporting :: Stored Procedure Test For Null/empty Uniqueidentifier

Sep 6, 2008

I have a stored procedure (SQL Server Express) that returns a count of records:

SELECT COUNT(AdminUserID) AS CountEm
FROM Licenses
WHERE (AdminUserID = @AdminUserID);

Table "Licenses" has a field "CompanyID" which is a uniqueidentifier.

I need to add a clause to the WHERE to exclude records from the count where "CompanyID" is null/empty.

In VB code I'd do this with "If Not (TheCompanyID.Equals(Guid.Empty)) Then"

How would I do this in a stored procedure?

View 2 Replies

DB/Reporting :: Adding Message Box If No Results To Display After Calling SQL Stored Procedure

Mar 10, 2009

I have created a search form based on my SQL database to search for individual records based on 3 types of criteria. The form is up and running but I want to be able to add some more code. I have assigned Stored Procedure to each click event for each button. What I wantr to be able to do is after value is added to text box and button is clicked if there are no reults to display than a message box is displayed with adequate message detailing this. Also is it possible to add a count of records to the form. Once value has been enetered ij tyext box and stored procedure runs and fills dataset with required data can I display a box to show number of records from this search.

[Code]...

View 1 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

Adding 'Please Select' To My SQL Stored Procedure?

Feb 15, 2012

one of my stored procedures updates a combobox using paramaters.

1) StudentID as the value member and 2) StudentType as the display member.

I want to add the item ' Please select' as index 0 and read that this could be done through SQL statetment union.

How would i write my SQL stored procedure to add this line?

View 23 Replies

Select Statement On A Stored Procedure From Net?

Jan 5, 2011

How can i select certain columns from a stored procedure, lets say i just want 2 of the 10 columns item and total sales.[code]....

View 2 Replies

Only Getting Results From First Select In Stored Procedure Using Datareader?

Oct 3, 2009

And I like the speed of the datareader over a datatable, so I'd like to make this work! Using VB.NET 2005. All the prior responses to the same problem say to return to datareader or use a datatable. I have no idea what return to datareader means.

View 3 Replies

SQL Server SELECT Stored Procedure According To Combobox.selectedvalue?

Apr 12, 2010

In order to fill a datagridview according to the selectedvalue of a combobox I've tried creating a stored procedure. However, as I'm not 100% sure what I'm doing, depending on the WHERE statement at the end of my stored procedure, it either returns everything within the table or nothing at all.This is what's in my class:

Public Function GetAankoopDetails(ByRef DisplayMember As String, ByRef ValueMember As String) As DataTable
DisplayMember = "AankoopDetailsID"
ValueMember = "AankoopDetailsID"[code]....

guess it's down to the WHERE part of the stored procedure, but I need a way to pass the selectedvalue of the combobox into the @AankoopID parameter.

View 2 Replies

DB/Reporting :: Select Second Highest Value?

Nov 25, 2008

I'm having a problem with my Access database.I have to select the highest ActieAantal before the last action ( )because the last action is always the sum (Totaal).this is a part from my table

Persoonid..........ActieAantal..........acties..........Actieid....... ...datum..........aantal..........totaal
.......... 3 ................ 1 ................... aa ................. 99 ........ 31/12/1975
.......... 3 ................ 2 ................... bb 94 ............. 98 ....... 31/12/1975 ........ 94
.......... 3 ................ 3 ................... cc 10 ............... 5 ....... 17/03/1989 ....... 10
.......... 3 ................ 4 ................... dd 20 ............... 2 ....... 25/08/2003 ....... 20
.......... 3 ............. 999 ............. totaal = 124............. 9 . . . . . . . . . . . . . . . . . . . . . . . . . 124

The next person also has some acties with corresponding Actieid and a Total when I use this query I alway get the 999 values

SELECT Register.Persoonid, Max(Register.ActieAantal) AS MaxVanActieAantal
FROM Register
GROUP BY Register.Persoonid
ORDER BY Register.Persoonid, Max(Register.ActieAantal);

but when I try to exclude the 999 value I get nothing

SELECT Register.Persoonid, Max(Register.ActieAantal) AS MaxVanActieAantal
FROM Register
GROUP BY Register.Persoonid
HAVING (((Max(Register.ActieAantal))<>999))
ORDER BY Register.Persoonid, Max(Register.ActieAantal);

find the highest 'ActieAantal' after excluding the 999 values?

View 2 Replies

DB/Reporting :: Use The Select Statements In VB?

Jun 28, 2011

Not sure if this is possible but can you use the select statements in VB to pull in from not just one but multiple tables and put the data in a gridview? [URL]

Code:
Imports System.Data
Imports System.Data.SqlClient
Public Class Form1

[Code].....

View 3 Replies

DB/Reporting :: Using Tow Select In Same Statement?

Dec 29, 2008

I'm using Vb2005 and Db MS access Is it possible to use tow Select in same sql Statement like this example:

Code:
"Select....Select......."

View 5 Replies

DB/Reporting :: Select Data With A DropDown?

May 11, 2008

I want to take a drop down menu. It will contain LastName, FirstName. I want that to select a record from a table. First Name and LastName are two different columns

View 5 Replies

DB/Reporting :: Select The Data From The Database?

Feb 25, 2008

Ive got a web page so that the users select a day from the calendar and the date is input to a text box, the format is dd/mm/yyyy, it is the same format in the database table.

I want to select the data from the database when it is = the date in the text box but it is retrieving data in mm/dd/yyyy format. My sql is:

SELECT Booking.Date, Booking.RoomNo, Booking.Lesson, [NoComps] - " & students & " AS diff FROM Rooms INNER JOIN Booking ON Rooms.RoomNo = Booking.RoomNo WHERE booking.Date= #" & txtdate.Text & "# AND booking.Lesson = '" & lessonlist.SelectedValue & "' AND booking.Type IS NULL

how can i make sure it retrieves the data using the correct date format?

View 1 Replies

DB/Reporting :: Selecting Within A Select Command?

Nov 1, 2010

I need to filter a measurements table that consists of 63 measurement objects that may or may not be tested more then once. The entries are put in a Batch table on a SQL server in the following fashion:

ID: | Serie | Test object | Min Amps | Max Amps | OK?
DateTime| String | Integer | Double | Double | Boolean

So there may be multiple entries in my database with the same series and testobject number but with (slightly) different results.

Currently I just select: SELECT * FROM Measurements WHERE Serie = 'XXXX' and use a datareader object to fill a datatable and then I let loose a routine on it that will either: Get the last result that produced a good measurement, so OK = 1 and max ID. Or the last result that produced a bad measurement if there are no good ones. I then end up with a list of 63 either good or bad measurement objects with the last good result, and if there isn't one then the last bad result.

Now I know that SQL is quite powerfull and I suppose that it must be possible to directly query for these results without a programatical routine re-filtering the results. I suppose it's like Selecting within a select statement..

View 2 Replies

DB/Reporting :: SQL Select Row And Update Recordset?

May 1, 2008

I am trying to use sql to select a row and then find the minimum and maximum values in the row, do some preprocessing, update the recordset using in visual basic 6.0, and then go ahead select the second row, find the minimum and maximum values again.. and go on, until the last row.

The problem is I am having difficulties using sql select for a ROWS.. I am aware how to do this for COLUMNS.. if I want to extract the first row from a recordset, find the min max values, and then, extract the second row and so on.. how will it be possible? (discouraged to use VBA, since i am limited to VB only)..

Here is an example of my recordset:

Code:
Col1Col2Col3Col4Col5
0.43530.05630.74350.92510.0325
0.28430.00320.82430.73250.9981

This example only lists two rows currently. I want to extract the minimum and maximum values from each row at a time, and then the second row. The reason for extracting minimum and maximum values is because I want to normalize my data in the range from 0 to 1.

Logic: After I find the min and maximum values for each row, I will use the recordset back, read the same row, and update every columns entry with my normalized data value... then proceed to the next row and do the same for every row in my database.

View 2 Replies

DB/Reporting :: Time Range Select With Or Without SQL?

Nov 18, 2009

I already have a problem..

Im trying to get the soft recognize the timerange between times:

For example:
START TIME: 10:00

[Code]....

I need to pick the time range between 10:00 and 05:00 in the morning.

I tried both - SQL Select and Visual Basic - both options didnt work when I needed to pick the time range as above. Normal ranges during the 24 hour cycle where ok.

View 2 Replies

DB/Reporting :: Being Able To Change Table Name In Select Query?

Dec 6, 2008

I have a stored procedure that I need to be able to change the table name that the select statement in the stored procedure uses depending on a user input, however I am having a problem with the code:

Code:
CREATE PROCEDURE [dbo].[spQryParentComments] @projTable as varchar(50)
AS

[code].....

View 3 Replies

DB/Reporting :: Can't Select Column Names With Spaces

Apr 7, 2012

I'm just a frustrated noob trying to get past my first DB Program. My goal is to get relational data from different tables all ordered by a certain field..Ive noticed early on that i cannot select a column when its name has a space.[code]Now the statement i want to use is sql = "SELECT [PT.Chart Number],[PT.Last Name],[CA.Case Number] FROM Table1 AS PT INNER JOIN Table2 AS CA ON PT.Chart Number = CA.Chart Number ORDER BY PT.Chart Number"..When i Debug i get the same type of error ("... Can't find column name PT.Chart... ")I'm new to sql so i dont know if my syntax is off.

View 4 Replies

DB/Reporting :: Select A Field But With SQL It Doesnt Work

Apr 6, 2009

I have a database and I wanna select a field ..I usually do this with access:

dim chosen as string
chosen = textbox1.text
Dim querysql = "select * from table where field = " & chosen & ""

But with SQL it doesnt work =S I really need to make this work .

View 7 Replies

DB/Reporting :: Vb6 To Vb2k8 Migration Sql Select Hangup?

Jul 22, 2010

I am attempting to migrate from vb6 to vb2k8. My first attempt is a program with three forms. The first form extracts data from Oracle into a local Access DB. It works great but the second form only pulls data from Access to generate a text file. The VB6 version does it in 10 minutes, the VB2k8 version gets 1/10th through the data in two hours. It is hanging on:

"select sum(hrs) as thrs from tablename where emp_id_no='xxxxxx' and hours_type='CE' and org_ofc_sym='oos'"

I have to hide identifying fields but the emp_id_no and oos are correct.

View 9 Replies

DB/Reporting :: Select Entire Row When Click On A Field In Datagridview

Apr 23, 2008

This is the only code I could find and it doesnt work:

Private Sub DataGridView1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles DataGridView1.MouseUp
Dim pt = New Point(e.X, e.Y)

[Code]....

View 2 Replies

Where Are The RGB Values Stored In The Array

May 31, 2012

I've been using the following sub in my control that I'm creating to let me modify the pixels in a bitmap faster:

Protected Sub LockForMemory()
idata = ime.LockBits(New Rectangle(0, 0, ime.Width, ime.Height), ImageLockMode.WriteOnly, ime.PixelFormat)
ipoint = idata.Scan0[code]....

This doesn't seem to work right, however.

View 1 Replies

DB/Reporting :: Select Monthname And Year From Mysql Date Format

Sep 24, 2011

anyone knows the query of selecting from monthname and year(September 2011) from mysql database DATE format(yyyy-MM-dd)

View 1 Replies

DB/Reporting :: Select Statement To Retrieve Data From .csv File Database?

Jan 29, 2010

I am using the following Select Statement to retrive data from my .csv file database:

Code:
Dim comm As New OleDb.OleDbCommand("Select *, Left([Street Full Address], IIF(InStr(12,[Street Full Address],'-')>0, InStr([Street Full Address],'-')-1, Len([Street Full Address]))) as StreetFullAddress From " &

[Code].....

View 4 Replies







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