.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How do I execute SQL2008 functions or procedures within VB Applics?

Posted By:      Posted Date: October 07, 2010    Points: 0   Category :WPF

I am able to create "functions"  in SQL2008, but I cannot understand how to execute them within my Visual Studio applications. I have many books that I've purchased which help me greatly, but I find none that discuss directly how to use SQL with objects on a windows form or how to create actions using "Functions" or "Procedures" by connecting them to objects like bttns or combo boxes to execute them.  There needs to be more help in directions that show how to tie screen applicatons to server side applications.  I am able to use Queries within datasets,but not functions or procedures.


Problem I am trying to solve:

I have a Login form that uses two parameters, @UserName and @UserPassword to select a row from my UserTable and to get the data for column "UserStatus" to verify that content shows "Active" rather than "Inactive" or "Null".  When all conditions are correct the "LogIn" Bttn allows movement to the opening screen which is a loan list where a loan (i.e.  "LoanNo") is chosen.  When a loan number is selected, all other screens and datasets should be filtered to that single loan selection and locked to that user until released.

I  own SQL 2008 and Visual Studio2008, but have  2010

View Complete Post

More Related Resource Links

Sql Scripts - Delete all Tables, Procedures, Views and Functions


In a shared environment you typically don't have access to delete your database, and recreate it for fresh installs of your product. 

I managed to find these scripts which should help you clean out your database.

Use at your own risk.


Delete All Tables

--Delete All Keys


Find all stored procedures/functions granted to a specific user


SQL 2005.

How can I find all routines (sp, fn) exec granted to a specific user in a given database ?

Thanks !!

SQL2008 INSERT INTO @table_variable EXECUTE(...) AT ORACLE_LINKED_SERVER error Msg 1206 "MS DTC has


Dear experts,

I'm trying to insert into a table variable from an EXECUTE(...) AT ORACLE_LINKED_SERVER statement but frequently I get one of the following errors:

Msg 1206, Level 18, State 124, Line xxx
The Microsoft Distributed Transaction Coordinator (MS DTC) has cancelled the distributed transaction.

Msg 8520, Level 16, State 1, Line xxx
Internal Microsoft Distributed Transaction Coordinator (MS DTC) transaction failed to commit: 0x8004d019(failed to retrieve text for this error. Reason: 15105).

Msg 3930, Level 16, State 1, Line xxx
The current transaction cannot be committed and cannot support operations that write to the log file. Roll back the transaction.

However, sometimes it works without error.

Apart from these errors, I don't completely understand why this is being treated as a distributed transaction because I'm inserting into a T-SQL table variable and I thought these were exempt from the usual transaction rules (apologies for my ignorance!).  I'd much prefer it if I could flag it as not being part of a transaction.

I've spent quite a bit of time with Google, MSDN, and OTN but can't spot anything which appears to match my particular problem so would appreciate any thoughts or help please.

Code running on MS SQL 2008 Enterprise Edition (64-bit) 10.0.2531.0 SP1 on W

Unable to execute system stored procedures - SQL Server 2000, SP4

I am unable to execute system stored procedures on a SQL Server 2000 server, running Windows 2003, SP1. If I try to run sp_updatestat I recieve a 2758 error after it updates a few tables. If I run sp_recompile, it returns the same error. If I run DBCC CHECKDB on the master database, it reruns a blank screen. Database and T-Log dumps work without issue. This started all of a sudden. I have restarted SQL as well as rebooted the server. Everything came up clean. Need advice desperately.
Steve Jimmo

Unable to execute system stored procedures - SQL Server 2000, SP4

I have a SQL Server 2000, SP 4 running on a Windows 2003 server with SP1. All of a sudden I am unable to execute system stored procedures. When I try to run sp_updatestats 'RESAMPLE' it will update the stats of a couple of tables and then return a 2758 error. I have tried to run DBCC CHECKDB on the master database which returns a blank screen. Database and transaction log dumps are working without an issue. Everything on all other databases works without a problem. I have restarted SQL Server as well as rebooted the server. Everything comes up clean. Cannot find anything on this type of problem and am desperate.

Excel 2010 Functions with SQL2008 don't work


Hi all,

it seems that with the following configuration Excel Functions don't work, because AS doesn't recognize it.

OS: WIN 2008R2

SQL: SQL2008 sp2 x64

Office: Office 2010 x86


Does somebody experienced the same issue?

I would need excel function NORMSINV..





Insert value using Table Value Functions

a real gem in Sql Server 2008. mostly people still using Stored procedure may be they shifted to SQL Server but they are not using TVF right now.

Introduction to Functions

A function is a section of code that is used to perform an isolated assignment. Once it has performed its assignment, the function can be accessed to present its result(s).

In Transact-SQL, a function is considered an object. After creating the function object, it becomes part of a database. You can then execute it when necessary.

Built-In Functions Fundamentals

While your primary job as a database developer consists of creating lists, probably your second most important job is to assist your users with the various assignments they must perform on your application. One way you can assist is to use functions that perform otherwise complex tasks. We introduced and described functions in the previous lesson. To assist your development with the different tasks of a database, Transact-SQL ships with various already created and tested functions. You just need to be aware of these functions, their syntax, and the results they produce.

Transact-SQL Built-In Stored Procedures

To assist you with managing Microsoft SQL Server databases, Transact-SQL provides many built-in stored procedures.

Renaming an Object

Sending Email

Built-in Functions - Text and Image Functions in SQL Server

Text and image functions operate on TEXT, NTEXT and IMAGE data types. These data types are deprecated with SQL Server 2005 and should be replaced by VARCHAR(MAX), NVARCHAR(MAX) and VARBINARY(MAX) when possible. Alternatively you can also consider storing large string values using XML data type. Text and image functions are nondeterministic.

Future versions of SQL Server will not support TEXT, NTEXT and IMAGE data types. Columns with TEXT / NTEXT data type do not support commonly used string functions such as LEN, LEFT, RIGHT, etc. Furthermore, due to the large size of TEXT data you''re likely to see performance issues if you store such data in the database. However, at times you can''t help but use the TEXT / NTEXT / IMAGE data types (for example when supporting 3rd party databases when you cannot change the schema) - this is when text and image functions come in handy.

Date and Time Functions in SQLSERVER

Date and time functions allow you to manipulate columns and variables with DATETIME and SMALLDATETIME data types.

1 DATEPART Function
2 DATENAME Function
3 DAY, MONTH, and YEAR Functions
5 DATEADD Functions
6 DATEDIFF Function
7 More SQL Server Functions

HttpContext.Items and Server.Transfer/Execute

The problem was basically that when a Server.Transfer call was applied the script container (and also various ClientScriptProxy script embedding routines) would potentially fail to load up the specified scripts.

Built-in Functions - Aggregate Functions

Aggregate functions return a single value summarizing a given data set. All aggregate functions are deterministic. NOTE: AVG, SUM, STDEV, STDEVP, VAR and VARP functions cannot operate on BIT data types; they can operate on all other numeric data types.

Built-in Functions - Date and Time Functions

Date and time functions allow you to manipulate columns and variables with DATETIME and SMALLDATETIME data types.

Cursor Functions

A cursor allows looping through a record set and performing a certain operation on each record within the set. SQL Server supports three functions that can help you while working with cursors: @@FETCH_STATUS, @@CURSOR_ROWS and CURSOR_STATUS. Cursor functions are non-deterministic.

Built-in Functions - String Functions

String functions let you extract various portions of character strings, change the case of strings, concatenate and reverse strings and perform many other types of manipulations. All built-in string functions are deterministic with the exception of CHARINDEX and PATINDEX
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend