IDE :: How To Use Procedures

May 10, 2009

I'm trying to learn how to use procedures?

Public Function mgboc(ByVal mboc1 As String, ByVal mboc2 As String) As String
Return mboc1, mboc2
End Function

But it doesnt work. I want it to "return" the parameters, but it won't even compile.

View 2 Replies


ADVERTISEMENT

Why To Use CLR Procedures

Jan 12, 2010

Why we use CLR procedures. Is there any significance of CLR Procedures or any example where CLR Procedure is the only solution?

View 4 Replies

Doing Computations With Procedures?

Jan 20, 2012

How can i call a procedure to calculate the cost of the suv and compact car mileage twice with that same procedure? Thats the only part i cant figure out with this function/procedure stuff. Also am i doing the procedures right?

Quote:

'Developer: John Nelson
'Date: Janurary 18 , 2012
'App Name: Compare Fuel Cost

[code]....

View 5 Replies

How To Use Stored Procedures

Feb 28, 2011

i have made some stored procedures for the first time and now i want to use them in vb.net code

'"Insert Procedure"
Sub InsertSettingz()
'Store the settings for the reports

[code]......

View 2 Replies

Multithreading With Same Procedures?

Nov 23, 2011

I have a function in my program that adjust sales for multiple days. Sometimes it needs to adjust up to 3 months and the tasks takes a while so I decided to split up the work between multiple threads. The way I have it working is say I need to adjust 3 months. I have the first thread adjust sales for the 1st month, the second thread adjust sales for the 2nd month and finally a third thread that will adjust sales for the 3rd month. Since all three threads are performing the same tasks except for different date range they use the same procedures. Within those procedures I make a call to the database to extract the sales for the given month. At some point it seems like the threads start to use the same SQL Data Objects because I am receiving the below error."There is already an open DataReader associated with this Command which must be closed first."Below is the first procedure that is ran by each thread up to the line where it errors out.

Private Sub Process_Adjustments(ByRef objAdjustBillCodeThreadParameters As clsAdjustBillCodeThreadParameters)
Dim cmd As SqlClient.SqlCommand

[code]....

So all three threads call this subroutine and the first thread does the data fill with no issues and then sometimes even the second thread does the data fill with no issue but then the third thread crashes and produces the above error. It seems as though the threads are sharing the same SQL Objects when all objects are local to the sub and I always thought each thread had it's own memory to work with. So I thought each thread would call the sub create it's own objects in memory, but that does not seem like what it's doing. I have other multithreading processes in my application that work perfectly fine, this is the first time I am attempting to multithread in this manner where I am using the same procedure within multiple threads.

Just thought of something that I might be doing wrong. The subroutine in question is in the same class where the threads are created. Should the subroutine be in it's own class, and therefore each instantiation of that class?

View 3 Replies

Sub And Function Procedures

Feb 3, 2010

I created a subprocedure to change the background color of the selected matching labels in this concetration game. Now I want to change it back to silver when all the labels are selected I tried all the insertion points I could think of for a EndGame function but none have worked. I'm thinking I'm barking up the wrong tree.[code]

View 1 Replies

Add Custom Procedures To Collection

Feb 18, 2010

I've lived in the VB6 world for the last 15 years and am only now starting to learn .NET. I've got a long way to go, but I am hung up on a fundamental issue about collections.I live and die by collections in VB6; I use them for just about everything I do.So I am very used to having the abilities that the intrinsic VB6 Collection has.Things like adding items with keys, referencing items by key or index, having the "Add" method return an instance of the object, being able to add custom procedures to the collection, having it strongly typed, etc.But all of the collection information I have read about in .NET doesn't really do all of this.(I am starting out in VB.NET, with the possibility of moving to C# at a later time, so i am trying to stay away from the Microsoft.VisualBasic namespace.)

View 11 Replies

Ado.net And Sql Server Stored Procedures?

Jul 25, 2009

Some question about Ado.net and SQL Server stored procedures. We have a stored procedure in SQL Server as described below

Procedure dob.PendingCalls
@UsID As Char(10), @Sts As Integer OUTPUT , @Msg As VarChar(100) OUTPUT
AS
Begin

[code]....

we are using vb.net in visual studio 2003. Now if ExecuteNonQuery is used then we do not get rows. If ExecuteReader is used then we get rows [ with forward-only access which is of no use to us] but we cannot get output parameters values returned by stored procedure?

View 13 Replies

Asp.net - Calling Procedures From Different Pages

Nov 4, 2011

I have a Custom.ascx file that is used on a number of pages. Custom.ascx contains a couple of controls and a button called cmdCustomPageButton. When the user click on cmdCustomPageButton, cmdCustomPageButton executes a Protected Sub that gets some data from a database.

Page1.aspx that is using Custom.ascx has its own set of controls and procedures that it executes. It contains a button called cmdPage1Button and a procedure called RetriveData that is being called by other procedures as well within Page1.aspx. When cmdPage1Button is clicked it calls RetriveData. RetriveData is only applicable to Page1.aspx. Page2.aspx and Page3.aspx both has a procedure similar to RetriveData but is only relevant to its own page.

Try to explain using code:

Custom.ascx

Public Class Custom
Protected Sub cmdCustomPageButton_Click(Byval sender as Object, ByVal e as EventArgs) Handels

[CODE]..............

The question. How do I call the different RetriveData procedure form the relevant pages being it Page1, Page2 or Page3 when cmdCustomPageButton is clicked ?

View 2 Replies

Calculating VAT Using Procedures And Functions?

Jun 3, 2011

Im currently working on a car service program on Visual Basic. The user simply selects some radio buttons, enters a couple of values and at the end the lablels are SubTotal, VAT and Total. Can anyone tell me how I calculate the VAT, the VAT rate I need to use is 20%. I currently have an appropiate answer for the Sub Total. I know I need to multiply the SubTotal amount by 0.2 but how do I do this using Procedures and Functions?

View 5 Replies

Calling Stored Procedures Using ADO.NET?

Jul 10, 2009

calling stored procedures using ADO.NET. We have an application developed, which uses SQL Sever as backend and Visual foxpro as front end. In this application every thing is done by database only. That is all insert, update, delete operations are done by SQL Server only. So we have to provide some input and output paramaters to stored procedures. Some time these procedure carry out insert, update, delete operations as well as return some data in the form of tables.

View 4 Replies

Collapse Groups Of Procedures?

Dec 29, 2011

I have a block of related sub routines I would like to "group" together within class to make navigating a littel easier. When I say group, I mean achieve the same functionality of being able collapse and expand a block of code as would with single procedure or class. Two alternative ways I can think to accomplish this is either use a partial class for those procedures or use namespace. I just wanted to see if VS for VB.Net had another way to be able group and collapse blocks of procedures.

View 3 Replies

Control Rather Than Formatting Procedures?

Jun 11, 2012

Am looking for a Currency Text Box control that will accept numeric key input and display entry as Currency according to Users Regional Settings.

Additionally, when an assignment is made such as Currencycontrol.text= 123.45 + 500 , user will see value displayed as $623.45 or formatted to regional specifications.

I do need a control rather than formatting procedures since my form could have 24 or more currency fields.

View 4 Replies

Controlling Tools From Different Procedures?

Nov 30, 2011

If I write many subs and functions in my code, the tools on the interface will stop responding to some of the subs and functions. What can I do about that?

View 1 Replies

Exec More Store Procedures?

Jul 26, 2010

The code below is right to execute more store procedures?

Dim mySQLCommand1 As New SqlCommand("sTruncate", myConn)
Dim mySQLCommand2 As New SqlCommand("sAddress", myConn)
Dim mySQLCommand3 As New SqlCommand("sProvider", myConn)

[code]....

View 1 Replies

LINQ With Stored Procedures For XML Raw

Jun 9, 2010

I am new to LINQ and trying to learn it. I have a stored proc which returns XML Raw and I need to call this proc using VB.NET and LINQ...

View 3 Replies

Procedures And Exception Handling?

Aug 6, 2009

I initially posted this in the wrong forum. I need help getting this to run properly. I'm trying to construct a fractions calculator. In order to complete it, I need to do it like this:Using Select Case statements, four Function procedures should be called based on the operation selected. Each Function procedure will calculate the correct operation and return the Decimal value to the calling procedure. The original procedure will print the result.

Now, the result should be calculated to the hundreths place and the input values should be validated by a Try-Catch Block.And of course, I've been having trouble with how to do this. I've attempted many times and this is what I have so far:

[Code]...

View 2 Replies

Separate The Two Procedures And The Events?

May 10, 2009

I just happened to be reading through a post and stumbled upon this and was curious. As I was remiss to go off topic in someone else's post, I've dragged it out here.What we are doing here is logically incorrect. We loop thru all the records and set the sheet locked state and button image. But since the button is just one element, so effectively the image set would be that of the last record.We need to separate the two procedures and the events they take effect too.Ideally we should set the sheet locked state while loading it. (maybe the form_load event etc.). And we should set the button image when we switch the sheets (e.g. sheet change/activate events). The selection of events however depends on your requirements and wisdom.

[code]...

I noticed how the image was accessed above. My question is this, what is the differences between the above method and Image = Image.FromFile(Path) and if any, what are the advantages/disadvantages of each? This is just for knowledge purpose and is not pertaining to any particular problem.

View 1 Replies

SqlDataSource And Stored Procedures?

Mar 30, 2009

I want to call a Stored Procedure using SqlDataSource. I've been reading the library documentation of the classes but i'm getting slightly confused. To call a stored procedure, I understand that I have to change the selectcommandtype and then set the selectcommand property to the name of the procedure.

'Change command type to stored procedure
SqlDataSource1.SelectCommandType = SqlDataSourceCommandType.StoredProcedure
'set name of stored procedure

[code].....

View 5 Replies

Stored Procedures Executing Twice?

Aug 28, 2009

For some reason my stored procedures are all executing twice! I have a static function that runs an SP given its name and the parameters and fills a datatable.

Public Shared Function RunSP(ByVal spName As String, ByRef spParams As Dictionary(Of String, String), ByRef pDataTable As DataTable) As Integer
Dim cmd As New SqlCommand
Dim lAdapter As SqlDataAdapter

[code]....

Is there something wrong with the code? I've checked with the debugger and the appropriate SPs are definitely only being called once, i.e. this function only runs once for a particular insertion function, but two things are inserted into the table.

View 2 Replies

Update A DB By Using STORED PROCEDURES?

Jul 28, 2009

I'm doing a program with VISUAL BASIC 2008 and i want to update a DB by using STORED PROCEDURES.

The DB is in SQL 2005, And I want to insert [NAME,LASTNAME,SEX].

I want to know what kind of conection use and how to send de parameters to the SP.

View 1 Replies

Use Stored Procedures With LINQ To SQL?

Oct 21, 2008

I am trying to use stored procedures with LINQ to SQL to perform insert, update, and delete operations. My update and delete procedures implement optimistic concurrency by checking the original values retrieved from the database with the current values in the database. A row count is returned to indicate if the row was updated. When I execute SubmitChanges on the data context to update the database, everything works fine except that the generated code doesn't check for concurrency. (I configured the insert, update, and delete operations to use the data context methods created from the stored procedures using the O/R Designer, and I assigned the original object properties to the method arguments.) I can customize the generated code so it works properly, but I know that I shouldn't do that because I'll lose the changes if the code is regenerated. I also know that I can add a partial class to extend the data context, but I don't know how to implement the methods correctly. All I really need to do is to have the methods return the row count, but, of course, that's not an acceptable method overload. I know that I can also call the methods directly rather than calling SubmitChanges, but it seems like this is intended to work with SubmitChanges.

View 8 Replies

Variable Passed In Sub Changes Procedures In Sub?

Apr 9, 2009

The code in my function looks like

FunctionMain(Product,var2,var3)
Call Function1
Call Function2

[code]....

View 11 Replies

Array Parameters In Functions/procedures?

Feb 1, 2011

I do need to write a procedure that carries an array as a parameter- The array can be an array of many types (Dates, Double, Strings etc)- The number of elements in the array is unknownExample:Private Sub MyArrayRoutine(MyFirstPatameter as string, MyArray as array of Object()

View 1 Replies

Asp.net - Generate A Menu With 3 Stored Procedures?

Jun 28, 2011

I have the following query:

I have 3 stored procedures that give me information to generate the menu of a website, which are:

1st procedure (call it sp_menu)

This procedure generates timely information on a menu (can be more than one)

The 2nd procedure (call it sp_submenu)

This procedure generates information on the submenu of this menu (can be more than one)

3rd Procedure (I'll call sp_item)

This procedure generates information on the sub-menu items (may be more than one)

How I can do to automatically generate the ASP.net menu with the information you give?

The information delivery process is similar to this:

sp_menu
MENU_ID --- MENU_NAME --- MENU_ORDER
1 --- MenĂº 1 --- 1

[Code]....

The menu is ul (unordered list), the submenu are li (list item) and item are ul (unordered list)

How do I get ASP.NET with VB (. NET 4.0) the order automatically?

View 2 Replies

BackgroundWorker - Calling Procedures From DoWork

Aug 30, 2009

As I teach myself VB, I'm working on using the backgroundworker. Mostly I'd like to use it to update a progress bar. But here the problem I'm running into...

When I use it like this:
Private Sub TestWorker_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles TestWorker.DoWork
Dim ListText As String
For Value As Integer = 0 To 100
If TestWorker.CancellationPending Then
[Code] .....

Where GetPlayerNames() is the Sub that really contains a majority of my code, which uses a class library I wrote, and calls other functions, etc. But this just causes the backgroundworker to skip right to the RunWorkerCompleted and executes no code. It seems to me you should be able to call procedures from the DoWork and then pass updates back via the ProgressChanged event. I can't image you need to consolidate all your code into the DoWork.

View 13 Replies

Backup All SQL Server Stored Procedures?

Mar 19, 2010

I'm trying to figure out a way to save all the stored procedures on a SQL Server 2005instance to text files. One of our developers has made a huge amount of StoredProcedures,and theseneed to be managed somehow between our test / integration and production environments. I know how to retrieve / run / create stored procedures, it's just the "save-to-file" i need.

View 2 Replies

C# - Entity Framework & Stored Procedures?

Nov 5, 2010

I noticed in the Entity Framework designer that you can map stored procedures for Insert, Update, and Delete operations. Is there any way to do this for Select operations as well, or is there a new direction for database access code where we don't really write stored procedures for our basic select operations any more?The company I work for is pretty adamant about always using stored procedures for every database operation, even though the Entity Framework makes the calls safe by calling sp_executesql.It seems like both LINQ to SQL and Entity Framework have moved away from using stored procedures for selecting the data. Is this an accurate statement?Just to clarify my question:I have a table in my database called Product. I use the wizard in the Entity Framework to generate my models...so I now have an Entity called Product. When I do the following query:

db.Products.SingleOrDefault(p => p.Id == 1);

It generates code similar to:

EXEC sp_executesql N'SELECT * FROM Product'[code].....

If it's not possible to do that using SingleOrDefault I'm fine with that. I'd much rather have the following:

db.Products.GetProduct(1);

Is this something that is normally done or do most people just have it dynamically generate the SQL?

View 2 Replies

Closing Form With Validating Procedures?

Jun 4, 2011

I am using validating procedures to validate user input from 4 text boxes. I am experiencing an issue using the 'x' button to close my form if invalid or no data is present in the textbox with focus when I click the 'x' button. Validating triggers and the message box appears. You can change the data to something valid and close fine but this is aggrevating. I changed the forms causevalidation attribute to false and created a sub to handle formclosing. In that sub I specified that causevalidation for all textboxes be disabled and also set e cancel to false. After that I tested with bad data and the message box showed again, but when I closed it the form closed also.

View 4 Replies

Convert From Both Cecilius And Fahrenheit Using Two Sub Procedures?

Oct 22, 2009

The lesson exercise is to convert from both Cecilius and Fahrenheit using two sub procedures. I thought I had this one in the bag..seemed pretty easy when I was doing it but my calculations are always 0..

This includes two radio buttons one for F and one for C the tempature text box and the results lbl along with two buttons, convert and exit. (see attached screen clipping)

Option Explicit On
Option Strict On
Option Infer Off

[Code].....

View 2 Replies







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