Sql Server - Executing Insertupdatedeletes - Use Linq?

Jan 4, 2011

I was looking at using linq to sql (or EF) rather than in linedynamic sql within my application but have hit a possible issue. My application modifies data against any number of random databases accross several sql instances, linq appears to structured towards a single database scenario. Would it be best to just continue using in line sql or is there a method of using linq without tying it down to a single database? An example of what I'm doing at the moment:

[Code]...

View 1 Replies


ADVERTISEMENT

Delay In Server Response Time While Executing Stored Procedures On Mysql Db Server?

Sep 7, 2010

I am using stored procedures in my application using vb.net, while executing stored procedures on mysql database server thru application, the response time from the server is more. Is there any settings that i need to set on mysql db server or any changes in connection string or in code.

View 14 Replies

.net - InvalidOperationException For Executing LINQ Query?

Sep 3, 2011

'Initialize The Database Connection'

Dim dbTRCoreDatabase As New TRCoreDatabase
'Query For Get The Employee ID'
Dim listEmployeeID As IQueryable(Of Long) = (From EmpMaster In dbTRCoreDatabase.EmployeeMasters Where EmpMaster.Email = [code]....

View 1 Replies

Change A Global Variable Value Based On Linq Query While Executing?

Nov 27, 2010

I have two module-level variables and Linq query. I want the results of the Let clause to change the global variables - is this possible?

For example:
Dim X As Integer = 0
Dim Y As Integer = 0

[code].....

View 3 Replies

Executing A DLL From SQL Server?

Feb 3, 2010

we want to write a DLL using VB.NET 2008 using .Net 3.5 that performs an HTTP request we then want to call the DLL From SQL Server 2005 (in a trigger) and pass the DLL some variables and get a return value.Where im at in the process.I have created the DLL 'HTTPDLL.dll'

Source:

Imports System
Imports System.Configuration
Imports System.Collections.Generic
Imports System.Text

[code].....

Perhaps i am calling it incorrectly but i havent been able to get it to work (always return 'invalid class string')

View 3 Replies

Executing Sql Server Stored Procedure In VB?

Mar 7, 2011

I want to execute a sql server stored procedure in vb using a button. The stored procedure as one variable that is read from a text file.I got it to read the variable from the text file but don't know how to execute the stored procedure.

View 1 Replies

Executing A SQL Server View From .NET Program Speed?

Mar 1, 2012

I am using VB.NET 2008 and SQL Server 2005.The program runs on a different machine than SQL Server machine.If I read a SQL Server view from my VB.NET program (instead of executing a stored procedure)for ex: Select a,b,c from MyView where account = '1' and symbol = 'abc'will the speed of executing the view depends on the resource (CPU and RAM) of the machine where the program is running or the machine where SQL Server is running ?

Dim m_cmdSQL As SqlClient.SqlCommand
Dim m_daSQL As SqlClient.SqlDataAdapter
Dim m_dsSQL As DataSet

[code]....

View 9 Replies

Sql Server - Set A DB Value To Nothing With Linq?

Nov 22, 2011

I have an interesting problem. I'm using visual basic and before saving a row with Linq, I want to set it to nothing, for instance:

element.def = Nothing

But, when I save the element I have a 0 in the database instead of Null. Does anybody know how should I save my item so that element.def = Null?

This is an update, element.def previously had a value and element.def is of Integer? type, so it should be possible to save it as null.

View 1 Replies

Asp.net - Web Server Linq To Sql Returns?

Jul 31, 2011

Im trying to make a web service in VB.net is their a way that i can return the results that i get from LINQ. ie "return objreturnLINQResults" I have tryed to set my Public Function GetAlarmsByGUIS(ByVal DeptGUID As String, ByVal IdNumber As String) As Linq.DataContext . i just keep getting errors.

Public Function GetAlarmsByGUIS(ByVal DeptGUID As String, ByVal IdNumber As String) As Linq.DataContext
Dim lqAlarms As New linqAlarmDumpDataContext

[Code].....

View 1 Replies

Get CurrentTime From SQL Server With LINQ/Entities?

Sep 14, 2011

I am using LINQ with Entity Framework, and I need to get the SQL server timeCan anyone tell me how can I create a method so it retrieves the current server time?

View 1 Replies

Hangs With LINQ-SQL Server And TransactionScope

Mar 17, 2010

I'm encountering a hang when the program tries to access the fruit database. I've already enabled network access MSDTC on both my development computer and the SQL Server server.

[Code]...

View 1 Replies

Sql Server :: LINQ To SQL Get Grouped MIN With JOIN?

Apr 19, 2010

I'm having trouble with a LINQ to SQL query getting the min value using Visual Basic. Here's the SQL:

SELECT RC.AssetID, MIN(RC.RecCode) AS RecCode, JA.EngineerNote from JobAssetRecCode RC
JOIN JobAssets JA ON JA.AssetID = RC.AssetID AND JA.JobID = RC.JobID
WHERE RC.InspState = 2 AND RC.RecCode > 0

[code]....

View 1 Replies

C# :: Aggregate Or Join Strings In Linq To Sql Query (SQL Server)?

Aug 6, 2010

Given a table like

ID | Name | City
1 | X | Y
2 | Z | Y

[code].....

View 2 Replies

Multi - Table Join Query In ASP.NET To SQL Server Via LINQ?

Jan 29, 2012

I'm working on an ASP.NET 4.0 site, which I inherited ownership of. It has a number of existing LINQ datasources pointing to individual tables. For example, to the Patient Encounter Summary table in SQL Server. The problem is in displaying the data there. It's a normalized database, so that table contains (for example) the provider ID, rather than the provider name.

It's simple enough to join the Patient Counter Summary to the Providers table (in SQL)... but how does one do that in ASP.NET? I'm not sure of the correct nomenclature, but the 'mid layer' is VB.

[Code]...

View 3 Replies

Sql Server - Converting Complex Sql Stored Proc Into Linq

Jan 24, 2011

I'm using Linq to Sql and have a stored proc that won't generate a class. The stored proc draws data from multiple tables into a flat file resultset. The amount of data returned must be as small as possible, the number of round trips to the Sql Server need to be limited, and the amount of server-side processing must be limited as this is for an ASP.NET MVC project. So, I'm trying to write a Linq to Sql Query however am struggling to both replicate and limit the data returned. Here's the stored proc that I'm trying to convert:

[Code]....

View 1 Replies

Sql Server - Read Data From A Database Using LINQ To SQL In VB Using An IQueryable?

Dec 2, 2011

I know how to select items from an array with LINQ, but what I can't figure out how to do is access a database using an IQueryable. I connected the database to my project, added two classes from the database to the "LINQ to SQL" .dbml file and saved it. In my programming assignment, I am not supposed to create a data source (table thing) to display the data, but update my own interface manually. In order to do it, I was told to instantiate this:

Private dogs As System.Linq.IQueryable(Of Dog)

(Dog is a class that I added to my .dbml file from the database file)Also, I am told it involves using a method

.AsEnumerable.ElementAt(index As Integer)

View 1 Replies

Connect Webapp VB/LINQ To A MySQL Database Server On A Linux?

Jul 7, 2009

I have a programmer who is using VB and LINQ; and I have a MySQL database that is running on a linux server. My programmer tells me that:he cannot connect to the MySQL database via LINQ if he was able to connect then it would require all sorts of rewriting I don't know anything about LINQ but I thought it was an ORM. As such, any DB server that is supported should work just fine? Right? OK, so maybe it's not an ORM... maybe it should generically connect to ODBC and render similar results?

View 1 Replies

Sql Server - Linq - Limit List To 1 Row Per Unique Values Based On Value (minimum) Of Single Field

May 3, 2012

I have a stored procedure (I cannot edit) that I am calling via linq.

The stored procedure returns values (more complex but important data below):

Customer Stock Item Date Price Priority Qty
--------------------------------------------------------
CUST1 TAP 01-04-2012 £30 30 1 - 30
CUST1 TAP 05-04-2012 £33 30 1 - 30
CUST1 TAP 01-04-2012 £29 20 31 - 99
CUST1 TAP 01-04-2012 £28 10 1 - 30

I am trying to limit this list to rows which have unique Dates and unique quantities in LINQ. I want to remove items with the HIGHER priority leaving rows with unique dates and qty's.

I have tried several group by's using Max and order by's but have not been able to get a result.

Is there any way to do this via linq?

EDIT:

Managed to convert brad-rem's answer into VB.net.

Syntax below if anyone needs it:

returnlist = (From p In returnlist
Order By p.Qty Ascending, p.Priority
Group By AllGrp = p.Date, p.Qty Into g = Group
Select g.First).ToList

View 1 Replies

Dynamic SQL To Dynamic LINQ In .NET With MS SQL Server 2008?

May 24, 2010

I need to represent the following query using LINQ:

DECLARE @PurchasedInventoryItemID Int = 2
DECLARE @PurchasedInventorySectionID Int = 0
DECLARE @PurchasedInventoryItem_PurchasingCategoryID Int = 3
DECLARE @PurchasedInventorySection_PurchasingCategoryID Int = 0

[code]....

Now, I know that a query in .NET doesnt look like this, this is my test in the SQL Design Studio. Naturally VB.NET variables will be used in place of the SQL local variables.My problem is this: All of the conditions after "WHERE" are optional. In that a query might be made that uses one, some, all, or none of the conditions. V.PropertyID and V.Value can also appear any number of times.In VB.NET I can make this query easy enough by simply concatenating strings, and using a loop to append the "V.PropertyID/V.Value" conditions.I can also make a Stored Procedure in MS SQL, which is easy enough.However, I want to accomplish this using LINQ.

View 2 Replies

.net - ActiveRecord Linq/NHibernate Linq Not Building Query Completely?

Jul 14, 2011

given this function:

Public Function Search(ByVal StartIndex As Integer, _
ByVal MaxResults As Integer, _
ByVal AccountNumber As String, _
ByVal LastName As String, _

[Code]....

instead of what I expected:

Select count(*) from remitline where lastname = "smith"

What am I doing wrong building up the where clause? I'm using Castle ActiveRecord 2.1

View 1 Replies

Performance Gain In LINQ Query Vs LINQ Stored Procedure?

Aug 6, 2009

if there is that much of a performance gain in running a LINQ stored procedure versus a LINQ query?

View 1 Replies

Linq To Entities. GetPropety(name).GetValue Not Recognised By Linq?

Apr 20, 2011

I have a listbox on my xaml form that I bound to a List(Of MyType) property. I populated this list like so:

Dim fields As List(Of CheckableFields) = New List(Of CheckableFields)
Using context As ITIPEntities = New ITIPEntities()
Try[code]....

Now I'm at the point where the user selects the fields they want included in a report and I need to iterate over the required fields. This is my linq query:

For Each checkedField In _requiredFields
If checkedField.IsChecked Then
If checkedField.FieldData IsNot Nothing AndAlso checkedField.FieldData.Trim IsNot String.Empty Then[code].....

View 1 Replies

How To Get Lamda In LINQ To Actually Filter For Dynamic Linq

Sep 10, 2009

Example-I have a person class

Public Class Person
Private _fname As String
Public Property Fname() As String

[Code]...

View 2 Replies

LINQ Query Using The Dynamic LINQ Library?

Mar 31, 2011

Forgive my ignorance on this.I have this LINQ Query:Dim ngBikersDataContext As New CarBikeWalkDataContext

bikersList = (From c In ngBikersDataContext.Reg_Bikers _
Order By c.L_Name _
Select New Bikers() With { _
.BikerID = c.BikerID, _
.F_Name = c.F_Name, _

[Code]...

with the error "Overload resolution failed because no accesible 'Select' accepts this number of arguments."
Over the "NEW" I get an error " ')'expected."

View 1 Replies

Do Until Loop Not Executing?

Nov 16, 2010

y question is I have a program that is used to add inputs to an array when the OK button is clicked. My problem is that the after the first click of the OK button the Do while loop does not execute again for a 2nd click.lling out my hair. Here is the code.

Public Class InputValue
Public Shared InputArray(0 To 9) As Integer

[code].....

View 8 Replies

Executing A FOR Loop?

Feb 1, 2011

Just trying to run a basic program where the user is prompted to enter five names, one at a time. I'm prompted one time. After entering one name I get the following error "Unhandled exception: System.NullReferenceException:Object reference not set to an instance of an object"

Here's the

Module Module1
Sub Main()
Dim SortedList
For SortedList = 1 To 5

[code]....

View 2 Replies

Executing An External App?

Oct 1, 2010

im working in a windows app that execute another apps.. writing the name of the app in a text box (i.e firefox.exe) and click enter to run it im using >> (System.Diagnostics.Process.Start(app_name.Text)) to run apps it works fine with me .. but it didnt with some apps like when I write for example ares.exe it says:Win32Exciption was unhandled :The system cannot find the file specified

View 1 Replies

Executing SQL From Code ?

Jun 22, 2010

I am running SQL 2005 Standard Server. I am using Visual Studio 2010 for development.

Let me just say that what I have below works, I would just like to have some constructive critisism.

CODE:

View 2 Replies

Name Of Currently Executing Method?

Dec 28, 2009

how to get the name of the currently executing method? I was thinking it was somewhere under My.Application, but I can't find it...

View 4 Replies

Sql - ExecuteNonQuery Not Executing - .net?

Oct 8, 2009

I'm trying to execute a SQL command, but I just can't find out why this is not working.This is how I defined the "execute" function in my class named "clsSQL":

[Code]...

View 6 Replies







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