Sql - Passing A List Of System.guid As Params To As SQL2008 Sproc?
Sep 24, 2009
I would like to pull a set of records in a SQL sproc by passing in a list of system.guid and also by passing in a list of integer keys.I can put the guids ihto a string, of course, but the question is - how do I quote the test values so they are recognized as UIDs by SQLIn essence I was to DECLARE @pklist AS VARCHAR(1000)-- This would look like "'45F4AE2A-D27C-D711-83FD-0008C7FA9683','EC824D02-D37C-D711-83FD-0008C7FA9683','BA8E4D02-D37C-D711-83FD-0008C7FA9683'" coming out of the execsql from vb .net - I think :-) but it seems it needs to look likeSET @pklist = '45F4AE2A-D27C-D711-83FD-0008C7FA9683,EC824D02-D37C-D711-83FD-0008C7FA9683,BA8E4D02-D37C-D711-83FD-0008C7FA9683'SELECT * from dbo.members WHERE members.cpk IN (@pklist)This only returns the record matching the first UID in the string. Is there something I can wrap a t-sql VARCHAR string with so each guid will be seen distinctly?In trying to do this with a list of integer keys, the problem is the value is seen as part of a string and is not cast to an integerIt would seem creating a table from a parsed version of the string passed in and then doing a JOIN would accomplish what I need as well, but struggling with the T-SQL syntax for that.
View 1 Replies
ADVERTISEMENT
Jun 21, 2010
I am currently creating an application to track timekeeping (a clock in/out system) and I am trying to work out the best way to do this.
I have a Main Form which contains buttons to ;
- Log in
- Out for Break
- In from Break
- Log out
When a user presses the "log in" button the logon form appears, the user then enters their username and password. What happens next is where I would like the help.
Process is as follows:Click Logon Enter Username/Password Check Logon Form for errors (eg no password etc) Check User is in Database (using SQL query) If user is in DB and username and pass are ok then refer back to the main form to perform Stored Procedure for what the user wants to do (eg logon or or out for break etc). Set label on main form to show user as logged on My question is should I be using a public variable and calling the main form again or in the user logon form having 4 options and using an IF ELSE to select the appropriate Stored Procedure?
View 3 Replies
Jan 6, 2010
The GUID is the SelectedValue of a ComboBox (cbNetwork) If I execute a Debug.Print on the cbNetwork.SelectedValue, I see:
645b9d20-23eb-469e-9faa-e287600a54f3
However, when I try to execute the Fill method of the DataTableAdapter, I get an error "Specified cast is not valid."
[code].....
View 2 Replies
Jun 10, 2012
I am trying to pass a System.Collections.Generic.List to another class. The collection is created in class2 and then passed into class1
[code]...
However I get a 'Null Reference Exception error' when I run the program. It seems f_str in the line 'For Each s As String In f_str' is null.
View 3 Replies
Nov 15, 2011
I am getting a really bizarre error and it makes no sense at all.Basically I have a user entity which has a Password property. This property is of Type Binary, the server data type being Binary(512).I am reading this value in and converting it to a byte array. However whenever I run my code I am getting a completely unrelated error of Unable to cast object of type 'System.Guid' to type 'System.String'.This strikes me as very odd since I am not using a property or variable of type string or GUID anywhere in this procedure where it falls over.
The code is below:
Public Shared Function ValidateUser(ByVal username As String, ByVal password As String) As UserValidationMessage
Using db As New EntityMapDataContext
Dim u = From user In db.Users
Where user.Username = username
[code]....
View 3 Replies
Aug 6, 2011
I am building a permissions system in vb.net against the normal Windows Server file system. Have not decided on the best method, but is there a way to get access to some kind of internal GUID that Windows might store for a folder. If I just store the path for security, then it quickly becomes very hard to update a database storing path information to get security information. If a folder had some kind of internal GUID structure that would be great. Is this available?
View 1 Replies
Feb 26, 2012
im workin on a task that will get the current computers Default Gatway, So i chose the easiest option, using the Registry, in most cases i find this with no problem at all, here's the code im using right now,
Public sHost As String = My.Computer.Registry.GetValue _
("HKEY_LOCAL_MACHINESYSTEMControlSet001servicesTcpipParametersInterfaces THE GUID NEEDED HERE ", "DhcpServer", Nothing)
Which works fine, if i put My GUID in where i've stated in above code, I get the right value ect..., no what i was woundering is how would i get the program to preform this task on another Computer as their GUID will be diffrent, if their away i can do this with simplicity?
View 3 Replies
Jun 22, 2010
I have a problem with Operator '&' someone may with this problem.
[Code]...
View 4 Replies
Mar 10, 2011
I'm using Linqer to convert SQL to Linq: Update EmployeeSite SET SiteId = Null
[Code]....
View 2 Replies
Apr 12, 2010
I have implemented inheritance for two parent classes called Table and Field. Each parent class has several child classes. In the Table parent class, I created a method that expects parameter List(Of Field).
I get an error when trying to pass in parameter List(Of ChildField) to the method that expects a parameter of List(Of Field). The error message is as below:
Value of type
'System.Collections.Generic.List(Of
com.hlb.icisbatch.data.ChildField)'
[Code]....
View 2 Replies
Mar 2, 2009
I wrote a stored procedure which select indate , outdate, and type from a database table. I have two different select statements where I was able to join the result by using UNION. My type results can be either M or T.I want to be able to have another column display in the results for the dates which indicates if it was a indate or a outdate.
[code]...
View 1 Replies
Jun 19, 2011
I was planning on using very similar code to the following to export to excel quickly[url]...
However, the data that I'm exporting is rather large and I find it unnecessary to grab a dataset from the sproc, convert it to a multidimensional array of objects and then export to Excel. There are two main reasons this is unnecessary. 1) It takes time to transfer that data from the dataset to the array. 2) There are then two instances of the data, one in the dataset and one in the array. Therefore, I would rather directly insert the sproc results into the array of objects and bypass the dataset altogether. I can't do this unless I know how many rows I'm getting back from the sproc in order to declare the array's size beforehand. [code]...
View 8 Replies
Mar 16, 2012
im trying to save data (0 or 1) from vb2010 to SQL2008.
How can I do it inside vb2010? In class or form? which 1 is recommended?
The following is I write in form class:
If Trim(CChar(cElectrical)) = CheckState.Checked Then
loDataAdpr.InsertCommand.Parameters.Add("@scopee", OleDbType.Char).Value = "1"
Else
loDataAdpr.InsertCommand.Parameters.Add("@scopee", OleDbType.Char).Value = "0"
End If
View 16 Replies
Oct 28, 2009
I have a VB6 application that is accessing an sql server 2008 database using odbc. The application also accesses an ACCESS database. How can I create a temporary table in my ACCESS database using a table from the SQL database. I have tried the following:
SELECT GLTransaction.* INTO TempAPEntry0 In C:DOCUME~1DONNPS~1.000LOCALS~1TempCSAReport2564.MDB FROM GLTransaction WHERE GLTRSource = 641;
View 2 Replies
Apr 8, 2012
I have a problem writing dates from VB2010 into SQL2008.
I am forming DateofBirth from Comboboxes using DateSerial, so far so good.
DateOfBirth=DateSerial(DobYear, DobMonth, DobDay)
MsgBox(DateofBirth) displays the date as DD/MM/YYYY, as I would expect in the UK.
But, SQL is expecting the date in MM/DD/YYYY format. When the DD is below 12 the variable writes in the database, albeit with DD and MM the wrong way round. As soon as DD goes above 12, the program halts with an SQLException, obviously because SQL knows that MM can't be higher than 12.
I am going round in circles trying to work out the method to ensure that the date variable in the SQL INSERT statement is in the right format.
View 4 Replies
Jun 30, 2010
I'm using VS2010 and SQLServer 2008. I'm trying to test for DBNull in datafields, but every formulation of a test I have imagined (or found) throws an error. Specifically,"The value for column 'ColumnName' in table 'TableName' is DBNull." (system.data.strongTypingException).Well, not too helpful. I know it's DBNull, and I want VB to recognize this.Here is what I've tried so far (all with the same result).
[code]...
View 7 Replies
Jan 27, 2011
I'm getting System.NullReferenceException error when I try to add the employee info to the Employees list.
[Code]...
View 4 Replies
May 3, 2012
i have issue returning a list in a web method. here is the code
<WebMethod()> _
Public Function getTags(para_parents As String) As List(Of getTypeDetailsByParentName_Result)()
Dim context As New PPEntities
[code]....
the error is
Value of type 'System.Collections.Generic.List(Of SaftyonRoad.getTypeDetailsByParentName_Result)' cannot be converted to '1-dimensional array of System.Collections.Generic.List(Of SaftyonRoad.getTypeDetailsByParentName_Result)'
View 1 Replies
Dec 2, 2011
It looks like passing a list's enumerator to a function "byval" is quite different than passing it "byref". Essentially, regular "byval" passing will NOT change the caller's "enumerator.Current value", even if the function advances the enumerator. I was wondering if anyone knows why this is the case? Is an enumerator a primitive like an integer, without an object reference, and hence changes to it don't get reflected in the caller?This function is byval, and gets stuck in an infinite loop, spitting out "1" message boxes, because the enumerator's "current" never advances past 5.[code]The difference between the two functions is only whether the listFirstItem__ function accepts a byval or a byref enumerator.
View 2 Replies
Feb 8, 2011
I'm a beginner in VB.NET programming.. Please help me on how to pass SQLParameters in the below function..
This my code:
[Code]...
View 1 Replies
May 5, 2011
Im having a hard time trying to pass the values from a list inside of a class. Im trying to display multiple lines of values from a list inside of a class. My "client" class stores multiple lines of values into a list(of class transaction), with the number value(num) counting each transaction that it adds to the list.
Code:
Public Class Client
Private m_tranlist As New List(Of transaction)[code]....
im trying to display each line that is stored in the list in a label, and im having major trouble. I know all of the results are added into the lists, but how do i call the list in my main form in order to display each line of all of the values? Would I have to look up an index or something?
View 1 Replies
May 1, 2011
I might be alone in this; but I was always under the impression that in .NET when you called a function you had to pass in values in the same order as the method.[code]I've ever seen just calls the method with the params in the correct order - is the named convention an old left-over from VB? If I were to use the := syntax in all my method calls, would people laugh during my next code review?
View 2 Replies
Aug 17, 2009
I have a old vb6 application I maintain,that has the settings in a separate xml file.
But now I have to move those "inside" (to remove the xml, don't ask why :) ).
What would be best place/"paradigm" for such
settings to be handled in vb6 Like database connections, general parameters. Also to be easy to change it, u know what I mean. I just searched on the web but until now could not find it. Of course it is easy to hard code the ones for the moment
View 2 Replies
Feb 19, 2010
I'm looking for a walkthrough to help me design/develope a simple Blog that has the following parameters:Logon Screen Authentication Membership --> Email Lost Password.Simple Treeview like structure Topic-> Multiple Posts (2) levels deep only Historic calendar in right banner or someplace.Search Feature By (Topic, Username, Entry Date...etc)Does anybody know where I can find guidance otherwise left to my own devices this could take me a while, be nice to have at least a solid starting point in the correct direction.
View 2 Replies
Dec 30, 2009
Check out the simple code below :
[code]...
What happens is that when the Item2 is selected in the first listbox, the second listbox automatically changes its selected item to the Item2. This happens just the same with the other listbox.
View 3 Replies
Mar 27, 2012
I have a function that returns a Datatable. I am passing a list of Integer as an argument. Then I thought tis would work.
Public Function GetEventsByEventType(ByVal EventType As List(Of Integer), ByVal DayInterval As Integer) As DataTable
Using con As New MySqlConnection(strCon)
[Code]...
as you can see. I use string.join to convert the list of integer to something like this. '1,2,3'. Problem is that is read as a string so i get the incorrect results. I need to have where EventType IN(1,2,3).
View 2 Replies
Jun 12, 2009
I'm having difficulty passing a variables in a an array list. [Code] I have to pass the paramvals array to the function. The paramvals array contains the string but not the value of variable of that name. For example, parmaval(0) should contain the value of vSequence but it showing me that it contains string "vsequence".
View 3 Replies
Jan 19, 2010
Following is the format of the data stored in my arraylist.
A-Amsterdam
B- Brussels
C-Canada
so and so forth. I wan to search my array list by passing just the first few characters till '-' So if i have something like AA-Test then i want to pass just 'AA' to check if it exists or not.
I know that i can use contains or binarysearch but it does not serve my purpose as they both compare objects.
View 2 Replies
Apr 20, 2010
I'm having an issue with an application suite I'm developing. The bulk of the work is done in a backend dll that relies heavily on delegate subs in the different apps.
The problem I'm having is, I have a lot of these delegates typed to require a parameter. (eg, Public Delegate Sub DelTypeA(ByRef param As Object)). The individual methods will have a DelTypeA as one of their params, and I will pass it AddressOf functionA that has that signature.
This works fine for strong typing as long as the signature is something incorrect (2 params, a byval instead of a byref). But if functionA has NO params, the delegate is still created!
This works fine if I genuinely don't need to use a param, eg if the sub is simpler and I would have ignored the param anyway. But I want the strong typing to work here.
EDIT: I should add that invoking the delegate also works fine for simpler subs; the param is just not passed because it had nowhere to go. But I want to force all the subs to match the signature and do their own ignoring of the param
View 1 Replies
Jun 2, 2010
[code]...
Is there any issues with this? If I'm kicking off half a dozen threads over and over? ie: I'm not using a system where the parameters will get mixed up/corrupted?
I've looked around, and if this is OK/safe to use, this seems the easiest way to get values/params into a thread.
View 5 Replies