I use the MS Sync Framework to sync my SQL Server instance with a local SQL CE file to make it possible working offline with my Windows app. I use GUIDs as keys. On my table I have a unique index on 2 columns: user_id and setting_id: Now I do the following: I create a new record in this table
Tag: c#
Get items that have less available quantity then needed
I have a list of order items and a list of inventory quantity per item I want to get the first of each item that I will not have enough inventory This is the list of order items OrderId Item …
How to convert this Entity Framework query to a SQL Server query
I have a query which is written in format like this: How do I convert this query to a plain SQL Server query to see what its output is? Answer In Entity Framework there are a few ways to look at the SQL a query generates. Note: All these ways will use this query: Cast IQueryable to an ObjectQuery and
Create XML from SQL select query
I am trying to create a xml from a SQL select, but I can not insert “:” (like cac:PartyTaxScheme), neither can put 2 data in one element, look element “cbc:CompanyID” (<cbc:CompanyID schemeName=”31″ schemeID=”0″ schemeAgencyID=”195″>900711000</cbc:CompanyID> ), how can I do it ? Next is the example I want to expect: Thanks a lot Answer Using Xml Linq :
Insert into select SQL with windowsForm
I want to insert some data in Table1 in my database selecting it from another Table2 but the Table1 has another attribute for username (ComputerName). What I have tried: Answer I think you are looking for something like this :
Inserting data row into a sql table from another sql table in C#
Context: I’m developing an app for windows in Visual Studio that has a table of stock materials and another of buyed materials, both in a Sql Server. I want that every time you buy something it is added into the stock table. I’m new in using SQL with c# combined. I’m trying this from a tutorial, but does nothing. Not
How to calculate employees working hours in sql
My company business hour is 7:30 to 18 and 13:00 to 15:00 is lunch time. Important part is about lunch time that should not calculate as working time of employee at all. So imagine employee start working at 8:30 and exit at 15:00 so the time of 4:30 hours should be calculate for him. actually I want to remove lunch
How do I use prepared statements with an OleDbDataAdapter?
I’m writing an API that will query a database given certain parameters. Some of those parameters will be supplied by the calling app (which should be trustworthy), but some of them will be supplied …
Incorrect number of arguments for PROCEDURE… from C#
I am having trouble using parameters in a stored procedure. I believe I am not passing the parameters in correctly with the C#. My code is roughly equivalent to: public static string GetCustomer(…
SQL query with dynamic parameters
I tried to get some data from DB. I need get account information from my table – this type of information will depend on User. If he/she will insert account type = 1 -> he will get this information. How could I create query if it will depend on user: for example user could choose one or more account types