I created a User Defined Function with VB.NET and want to use that function in SQLServer. Everything seems to work fine. Now I want to use an array as parameter. Example of my test method (without parameters):
Partial Public Class UserDefinedFunctions
<Microsoft.SqlServer.Server.SqlFunction()> _
Public Shared Function TestFunction() As SqlString
I'm attempting to pass in a collection of dates to a T-SQL 'IN' clause via a date array (see below for how data is collated).
'Workout weeks difference between start and enddate Dim wksDifference As Integer = CType(DateDiff(DateInterval.WeekOfYear, bookingStartDate, bookingEndDate), Integer)
I'm wondering if this sort of thing is possible in VB.NET.. say I have a routine which accepts an integer array, defined as:
Sub WriteTable(iRows As Integer, arrColumns As Integer()) The arrColumns parameter is an integer array of column widths. I can pass a value by doing this:
ALTER PROCEDURE dbo.uspGetOrderTrackingHeaderInfo @ContractID varchar(9) , @SalesRepID int , @StatusID int , @TypeID int , @StartDate datetime [Code]...
I'm trying to create a function to parse out all values in a multidimensional Array with all but one dimension given. The details are not relevant, but for this function I need to return an one-dimensional Array containing values of the same type the original multidimensional Array has.To pass any Array with any dimension to my function, I declared the type of this parameter as Array. However, how would I create a new Array of that specific type (e.g. Integer)?Currently I have the following code:
Function GetRow(ByVal arr As Array) As Array Dim result As (...) 'This should be Integer() if arr contains Integers, etc. Return result
I am working with some code that uses array lists and I am using some of these to pass data back and forth like this: whatFile = (sideLookUp(x)) and its working, BUT when I turn this code into a sub/function then I call it I get problems, like double to string errors, even though its all set to double.
I'm trying to create a parameter insert statement for an SQL server Db. when i've used similar code for an access db, it works fine. can anyone tell me what i'm doing wrong? Public Sub SubmitMyData(ByRef getArray)
Dim MySQL As String = "INSERT INTO WebSurveyResults(Q1,Q2,Q3,Q4,Q5,Q6) VALUES Dim myConnString As String = "Data Source=jasonwucinski1.db.1111111.hostedresource.com; " _ & "Initial Catalog=jasonwucinski1; User ID=jasonwucinski1; Password='myPW';" Dim thisConnection As New System.Data.SqlClient.SqlConnection(myConnString)
Is it possible to create a routine in VB.NET with a name-based parameter array? The WebMethod attribute built into the framework is used exactly this way: WebMethod(BufferResponse:=False)
Specifically, I'd like to use it in a class' constructor. I'd like something similar to this:
New MyObject(id:=10,buffer:=True)
I'm not even sure what the terminology is for this kind of parameter list, so I can't even find it when searching.
I am a little bit confused by the following VB statement commands = Regex.Split(script, _ "GO", _ RegexOptions.IgnoreCase)
I know what regex.split does. I know what the first parameter is. The second parameter is what I'm confused by. I think it is using the word "go" as a delimiter to split the first parameter into an array of substrings. But I don't understand what that refers to.
I have a gridview which I databind to EntityModel This typically looks like
something a something b companyID
on Login I get and set the compnay which has the ID so what in essence I want to do is on databind set the Where clause of data source to what the server side paramter for company ID is. I am sure this is super simple but it is driving me nuts
Here's the situation. Due to the design of the database I have to work with, I need to write a stored procedure in such a way that I can pass in the name of the table to be queried against if at all possible. The program in question does its processing by jobs, and each job gets its own table created in the database, IE table-jobid1, table-jobid2, table-jobid3, etc. Unfortunately, there's nothing I can do about this design - I'm stuck with it.
However, now, I need to do data mining against these individualized tables. I'd like to avoid doing the SQL in the code files at all costs if possible. Ideally, I'd like to have a stored procedure similar to:
[Code]...
Is this even possible in SQL Server 2005? Alternate ways to keep the SQL out of the code behind would be welcome too, if this isn't possible.
I'm using VS2010, vb.net, .net framework 4.0, and SQL Server 2008 Express on Windows 7 Pro with all updates installed. I have developed a website that uses memberships, profiles, and roles. I allowed the built in providers to create the aspnetdb.mdf file for me in the App_Data folder. I added a number of my own tables to aspnetdb.mdf so I would have a single database for all my site's data.
I am hosting the site on my own server. It uses Windows 2003 Server, IIS 6, SQL 2008 Express, and all of my software including the OS is up to date with the the latest servicepacks, updates, and all of the .net framework updates including 4.0. There are no updates left to install and I'm sure that my issue isn't due to a missing update or framework version.
I copied the aspnetdb.mdf and .ldf files from my app_code folder to the sql server express folder on my server and attached the database. I do this because I don't want the file to autoattach, because I will likely use a commercial hosting service in the future. I added a sql server user with ownership rights to the DB. strong text
I then modified my connection string in web.config to point to the UNC of my SQL Instance on my server and to authenticate with the sql server username and password that I set up with ownership rights to that database. I updated my membership, role, and profile providers in my web.config file to use the new sql connectionstring and I was sure to include the application="/" setting and to use before each provider.
I can run the site just fine from my development machine. I can log on to it and use all of its features. However, when I publish the site to my server I can access the site, both locally over my intranet and over the internet. I can navigate around on it and it retrieves all of the data from the tables that I added to the database myself, but when I try to log on to it or to create a new account (basically anything that uses memberships, roles, or profiles) the site crashes with the error and all of the data below.
I've checked to verify that the application name in my aspnetdb database is in fact simply "/". I've ensured that I'm running from an application pool that is using the 4.0 framework. Much of the googling and reading that I've done seems to indicate a problem with my providers, but I can't understand why it works perfectly on Casini (or whatever the development server is called) on my local machine but crashes on my web server. In both cases they are connecting to the same database.
I would be so grateful if anyone could tell me what I'm doing wrong here. Following are the full error displayed by my server when the site crashes and also what I feel are the relevant sections of my web.config file.Full content of error message and relevant sections of web.config are below:
Server Error in '/' Application. Value cannot be null. Parameter name: type
I am porting Excel VBA to VB.NET. I have a function that takes a selection of data, and it may be one dimensional or two. VBA code is quite fluid about using a variable as either a 1-D or 2-D array, but VB.NET marks it as an error.
Here is the reduced code: Public Function Stat(ByVal Data As Range) As Object Dim Y() As Object
i am working on visual stdio 2008(vb.net) and sql server 2008 i working on crystal report 9 i have created a stored procedure in sql server i have add this procedure in crystal report data expert now i just want to pass a parameter to crystal report so that it will show me data in crystal report?
I am working with TVP and I am trying to pass a data table to the stored procedure as TVP. When the command tries to ExecuteNonQuery it throws an error:Operand type clash: datetime2 is incompatible with int. The data for table-valued parameter "@tvpPermitWork" doesn't conform to the table type of the parameter.I checked the data table using the visualizer and I find all the data to be correct. I am now stuck and I don't have the time to change it to stored procedures with individual parameters.
We are going to change the connection string in Settings.vb so we don't need to worry about what it is when our app runs on a different computer other than the development computer.
Following code doesnt work and raise error "A parameter is missing. [ Parameter ordinal = 1 ]".What s wrong with it?I am developing pocket pc application in vs 2008 and sqlce 3.5 sp1.
I want to have a "template" function that can receive different parameter and a type parameter, like:[code]But Vb told me that tupeList is not defined... is there a way I can do that?