Tuesday, March 31, 2015

Get key from Dictionary for all elements in array

I just thought I'd push my luck and ask an additional question. It's somewhat related to my original problem. By the end of my application there will be be several Lists/Dictionaries statically input into my program, although it's starting to make things look cluttered as some of the Lists are quite extensive.


Considering that all this data is static and will never change, is there any format that this data would be better to be stored in?


An example of this is the Dictionary that I use to store the character-to-integer mappings.


Get key from Dictionary for all elements in array

It is best to start a new thread with your question. Don't forget to include the details such as where this data comes from (are you hard coding it in every time) and how the lists are used.


Mark as answer or vote as helpful if you find it useful | Igor


Update parent status based on all children status and sum of children amount.

How is Table 3 related to the other two tables?


Jason Long


Update parent status based on all children status and sum of children amount.

Thank You for the response Jason. Table 2 is related to table 3 via reference column.


5654471 4336620 - In this 4336620 is the ID of table 2. We need to parse the column when joining.


Update parent status based on all children status and sum of children amount.

Hi Spunny,



Thanks for the clarification, the scenarios listed do help to comprehend the logic.



For this case, since the status is enumerable, I would suggest to use a auxilliary table as below.




CREATE TABLE [Status]
(
ID INT,
Status VARCHAR(99)
)

INSERT INTO [Status] VALUES
(1,'Reconciled'), --you should assign the id sequence based on the status priority
(2,'Partially Reconciled'),
(3,'Settled'),
(4,'Partially Settled'),
(5,'Mismatched')



You can join the [Status] table and aggregate grouping by parent. See the pseudo code as below.


;WITH cte AS(
SELECT ParentID,CASE WHEN SUM(childAmount)=MAX(parentAmount) THEN MAX(s.ID) ELSE 5 END AS Status_ID FROM ParentChildren p JOIN [Status] s ON p.childStatus = s.Status
GROUP BY ParentID
)
SELECT * FROM cte c JOIN [Status] s ON C.Status_ID=s.ID



If you have any feedback on our support, you can click here.





Eric Zhang

TechNet Community Support




Two apps, same functionality but different branding? (Product Flavors?)

I'm still trying to come up with a perfect solution.


The biggest issue is all the image assets (e.g. the tile icon, etc.). I haven't figured out a way to dynamically change the tile and store images or app package name. To overcome this I am using a mostly empty project that contains all that stuff and just calls a separate main project and passes along an object containing the other branding details (colour scheme, app name, etc.).


So my apps have a branded project and a main project. You can build the main project separately and add a reference to it to your main solution (which contains only the branded components and no actual code or pages).


In a sense the branded project serves as a 'head' to your app. It's essentially empty.


I have no experience with pre-build steps, but you should be able to swap out the tile images. I will look into that myself as it may be a more elegant solution than what I'm using.


You could set up conditionali compiling (you need to create different compile options like 'ReleaseBrandA', then in your code you can do this:


#if ReleaseBrandA


// brand A specific code


#endif


If you build your app with enough foresight you can probably avoid that by keeping any brand-specific code in the branded project.




I'm a self-taught noob amateur. Please take this into account when responding to my posts or when taking advice from me.


Windows 10 Dev Tool Preview - Views?

So, to understand your question correctly:


You have 2 XAML pages: Page1.xaml and Page2.xaml and you want to have one common code behind called: common_code_behind.cs and the paragraph from the documentation is misleading.


Please clarify.




Windows Store Developer Solutions, follow us on Twitter: @WSDevSol|| Want more solutions? See our blog


Windows 10 Dev Tool Preview - Views?

Let's say you have two versions of your XAML, Page1_Phone and Page1_PC or something. Each of those has a code behind (Page1_Phone.xaml.cc & Page1_PC.xaml.cs). Each of these pages should belong to the same class (e.g. Page1), but you'll navigate to the appropriate page depending on platform.


Create a 3rd code-behind file (e.g. Page1_Shared.xaml.cs) and make it a partial class:


public partial sealed class Page1


Put all your shared code in there and your platform-specific in the other files. It's all compiled to the same class.


I did a blog post recently (blog.grogansoft.com) about this very topic for Windows 8.1 apps (it should be a little different for Windows 10 because you don't have multiple projects necessarily). The post explains it in more detail, so have a look if the above doesn't make sense.


EDIT: p.s. You might want to upload an avatar image to your account because the random image generator gave you a rather unfortunate one.




I'm a self-taught noob amateur. Please take this into account when responding to my posts or when taking advice from me.



SELECT is slowly !!Can you help me??

table Structure is


(


ID BIGINT PRIMARY KEY,


Name Nvarchar(50),


BornDate DATETIME,


Address NVARCHAR(255)


);


record 2 millions


Query SQL


SELECT COUNT(ID) FROM U WHERE Name LIKE '%N%' AND Address LIKE '%New%';


Query Time: over 1 minute


First time is very slow


How is Fast in first time???



SELECT is slowly !!Can you help me??

First time is very slow or fast? your statement is confusing, pls re-phase.

SELECT is slowly !!Can you help me??

Hi,


You can use indexes to improve the performance.




SELECT is slowly !!Can you help me??

table Structure is


(


ID BIGINT PRIMARY KEY,


Name Nvarchar(50),


BornDate DATETIME,


Address NVARCHAR(255)


);


record 2 millions


Query SQL


SELECT COUNT(ID) FROM U WHERE Name LIKE '%N%' AND Address LIKE '%New%';


Query Time: over 1 minute


First time is very slow


How is Fast in first time???



SELECT is slowly !!Can you help me??

First time is very slow or fast? your statement is confusing, pls re-phase.

SELECT is slowly !!Can you help me??

Hi,


You can use indexes to improve the performance.




Try Catch Block

Hi,


I am trying to develop best try catch block to be standardized in all of the SPs. Below is what I have right now developed which is giving me proper formatted output, would like to add more details or remove unwanted items from it.


Thanks for all your help!


I am using 2008 R2 Version, would be migrating to 2012 soon.



BEGIN CATCH
IF @@TRANCOUNT > 0
BEGIN
ROLLBACK TRANSACTION
END

DECLARE @ErrorMsg varchar(2100);

SET @ErrorMsg = ' DBName = ' + DB_NAME() + CHAR(10)
+ ' ErrorMessage = ' + LTRIM(CONVERT(VARCHAR(2047), LEFT(Error_Message(),2044))) + CHAR(10)
+ ' Procedure = ' + OBJECT_NAME(@@PROCID) + CHAR(10) + ' ErrorNumber = ' +
LTRIM(CONVERT(VARCHAR(9),Error_Number())) + CHAR(10)
+ ' ErrorState = ' + LTRIM(CONVERT(VARCHAR(3),Error_State())) + CHAR(10)
+ ' ErrorSeverity = ' + LTRIM(CONVERT(VARCHAR(3),Error_Severity())) + CHAR(10)
+ ' LineNumber = ' + LTRIM(CONVERT(VARCHAR(9),Error_Line())) + CHAR(10)
+ ' ErrorDT = ' + CONVERT(VARCHAR(23),GETDATE(),121) + CHAR(10) + ' ErrorBy = ' + SUSER_SNAME();


RAISERROR(@ErrorMsg,16,1);
RETURN -1
END CATCH







Neil



Try Catch Block

Hi,


I would probably use XACT ABORT like below



BEGIN CATCH
IF XACT_STATE <>0
BEGIN
ROLLBACK TRANSACTION
END

DECLARE @ErrorMsg varchar(2100);

SET @ErrorMsg = ' DBName = ' + DB_NAME() + CHAR(10)
+ ' ErrorMessage = ' + LTRIM(CONVERT(VARCHAR(2047), LEFT(Error_Message(),2044))) + CHAR(10)
+ ' Procedure = ' + OBJECT_NAME(@@PROCID) + CHAR(10) + ' ErrorNumber = ' +
LTRIM(CONVERT(VARCHAR(9),Error_Number())) + CHAR(10)
+ ' ErrorState = ' + LTRIM(CONVERT(VARCHAR(3),Error_State())) + CHAR(10)
+ ' ErrorSeverity = ' + LTRIM(CONVERT(VARCHAR(3),Error_Severity())) + CHAR(10)
+ ' LineNumber = ' + LTRIM(CONVERT(VARCHAR(9),Error_Line())) + CHAR(10)
+ ' ErrorDT = ' + CONVERT(VARCHAR(23),GETDATE(),121) + CHAR(10) + ' ErrorBy = ' + SUSER_SNAME();


RAISERROR(@ErrorMsg,16,1);
RETURN -1
END CATCH





Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it



My Technet Wiki Article


MVP



Try Catch Block


Hi,


I would probably use XACT ABORT like below



BEGIN CATCH
IF XACT_ABORT <>0


Hi Shanky, shouldn't that be



BEGIN CATCH
IF XACT_STATE() <> 0


Try Catch Block

Here is a short article, that gives you a template for how write CATCH blocks:

http://ift.tt/1itfZPi





Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Try Catch Block


Hi Shanky, shouldn't that be



BEGIN CATCH
IF XACT_STATE() <> 0



Ohh!! that was a mistake, thanks for pointing. Corrected it.



Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it



My Technet Wiki Article


MVP


Converting Microsoft Access Reports to SQL Server

Hi Mark123321,


According to your description, you want to import Access reports to Reporting Services.


In Reporting Services, there is an Import Reports feature for us to import Access reports. When we use the import feature, all reports in the database or project file are imported. But we should notice that Reporting Services does not support all Access report objects.


Reference:

Import Reports from Microsoft Access (Reporting Services)

Importing Access Reports into SQL Server Reporting Services


If you have any question, please feel free to ask.


Best regards,

Qiuyun Yu




Qiuyun Yu

TechNet Community Support




System.IndexOutOfRangeException: Index was outside the bounds of the array. Linq To Sharepoint

I'm having the same issue. When I receive this issue, I just reset the app pool or IIS then everything is fine. Very very strange. Is this a SharePoint bug? I'm using a state machine workflow (LINQ) and InfoPath.

Sharepoint Site User name,created by and Modified field issue

Hi Rajshekhar,


Actually, the users have been added to the site groups or granted with permissions in Site Permissions, then the users will be added to the User Information List of the site collection.


I recommend to check if the users you added have already been listed in the User Information List.


If yes, then the Created By and Modified By fields have already been filled with other values.


Created By field will show the user name who is the first one to add the user to the site and the Modified By field will show the last one who edit the My Settings of that user.


To access the User Information List, you can type the URL like this: http://server/_catalogs/users/detail.aspx.


Best regards.


Victoria




TechNet Community Support

Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.



Using (Select All) for report parameter









Hi there,


I am Looking for assistance in making the the (Select All) option work for a particular report. The parameter is for product families (which there are about 47 unique results for). The report is also influenced by two other parameters, one being a date type i.e 'MTD' 'YTD' 'MAT'. When a long date type such as MAT is selected, selecting all families causes the report to get stuck in an endless loop.


I've tried creating my own <Select All'> item in the parameter dataset, then I have the opposite issue, the <Select All> selection works perfectly but when I try and tick two or more product families I recieve the following error:


"An expressions of non-boolean type specified in a context where a condition is expected, near ',' "


Parameter Dataset:



SELECT '<Select All>' AS family_description, '<Select All>' AS family_code
UNION ALL
SELECT DISTINCT family_description, family_code
FROM dim_item AS item
ORDER BY family_description

Snippet From Main Report Dataset:



Where

sales.oe_branch_code IN (@Branch)
And
sales.order_status <> 'X' and sales.line_status <> 'X'

AND (item.family_code IN (@Family) OR @Family = '<Select All>')

Any help is appreciated


Thanks Kindly


SQL Novice






Using (Select All) for report parameter

Hi,


There is not a lot to go on here, but a couple of hints for you to try.


Try declaring the filtered parameters into a temp table. This will not only help you with testing where you can display the result set, but you can also then select from it later on.



DECLARE @Params TABLE(family_description NVARCHAR(100),family_code NVARCHAR(20))
INSERT INTO @Params
SELECT DISTINCT family_description,family_code
FROM dim_item item
ORDER BY family_description

Your WHERE clause should be something more like this, which gives you a distinct list of family codes.



WHERE sales.oe_branch_code IN (@Branch)
AND item.family_code IN (SELECT DISTINCT family_code FROM @Params)



Gavin Clayton Claytabase Ltd www.claytabase.co.uk


Using (Select All) for report parameter

your problem is here...



AND (item.family_code IN (@Family) OR @Family = '<Select All>')



Please see following link for way to enable multi parameters in SSRS.




Regards,

Vishal Patel

Blog: http://vspatel.co.uk

Site: http://lehrity.com


Using (Select All) for report parameter

For your main report dataset.is it text or procedure ?

Using (Select All) for report parameter

Hi,


You can create stored procedures with parameter that coming from report with default value = Parameters!Parameters1.Count


then you must parse MultiValue param using this function


and compare count from function to count from report.


Loop through sub-directories

for should be foreach.



string [] dirlvl2Ent = Directory.GetDirectories(dir);
foreach(string dirlvl2 in dirlvl2Ent)
{

}





jdweng


t-sql 2012 change logic to not be a cte

CTEs don't "nest" like that... The syntax looks more like this...



;WITH Daily_CTE AS (
>>Your SELECT big query here<<
), ABSResults AS (
SELECT
perID,
[date],
CAST(CASE
WHEN code IN ('GOT','SSS','UNV')
THEN CASE
WHEN SUM(absentMinutes) / dayMinutes > 1
THEN 1
ELSE SUM(absentMinutes) / dayMinutes
END
ELSE 0
END AS DECIMAL(8,3)) UnDays
FROM Daily_CTE
GROUP BY perID, [date], code, dayMinutes
ORDER BY perID, [date] DESC
)
UPDATE Atrn SET Atrn.ABS = ABSResults.UnDays
FROM
dbo.AtnDet Atrn
JOIN ABSResults
ON Atrn.perID = ABSResults.perID AND Atrn.[date] = ABSResults.[date]
WHERE
Atrn.ABS <> ABSResults.UnDays OR Atrn.ABS IS NULL





Jason Long


Loop through sub-directories

Hi,

I want to loop through the sub-directories of one given folder. How to correct the following problems?




dir = args[0];
...
try
{

string [] dirlvl2Ent = Directory.GetDirectories(dir);
for (string dirlvl2 in dirlvl2Ent)
{

}

Error 1 ; expected F:\App8\Program.cs 50 37 ProcessSWFile
Error 2 ; expected F:\App8\Program.cs 50 40 ProcessSWFile
Error 3 Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement F:\App8\Program.cs 50 40 ProcessSWFile







Many Thanks & Best Regards, Hua Min


StringFormat or converter for binding dates?

Hi,


I have a datetime that is being bound to a listbox and I only want to show the time portion of it.

I've tried


<TextBlock Text ="{ Binding TimeFeedStart, StringFormat=t }" Margin ="3,0,0,0"/>


But this throws an error.


Am I correct in thinking that StringFormat doesn't work on binding in windows apps?


If this is the case, can someone please help me with a converter that I can use to get the output I require?


Any help is gratefully received.


Thanks


How do I fill an Excel spreadsheet with the contents of a DataTable? (C#, OleDb)

Issues with Bulk insert in SQL

Newbie here


I have some flat files which I am uploading via the Bulk insert functions. All, except one, went fine.


The one with the issue, I decided to have a staging table whereby all the fields are varchar(50). The input file does have some dates and floats.


The problem I am now facing is to upload from the staging table to the final destination table, whilst converting the dates & floats back as should be.


Any quick and easy solution?


Kind regards


Ash



Issues with Bulk insert in SQL

What for a quick&easy solution are you expecting? Use CAST and CONVERT (Transact-SQL) function to convert the data.


Olaf Helper


[ Blog] [ Xing] [ MVP]

Issues with Bulk insert in SQL

Guys,


will give it a try now.


Much appreciated


Issues with Bulk insert in SQL

Hi Ash1807,



For SQL Server 2012 or onwards, TRY_PARSE is suggested in your scenario.



  • Returns the result of an expression, translated to the requested data type, or null if the cast fails in SQL Server. Use TRY_PARSE only for converting from string to date/time and number types.





SELECT TRY_PARSE('Jabberwokkie' AS datetime2 USING 'en-US') AS Result;

Result
---------------
NULL



If you have any question, feel free to let me know.



Eric Zhang

TechNet Community Support




t-sql 2012 change logic to not be a cte

Thank you for your answer so far! Can you should me another way to just use the sql I listed above to use only 1 update statement if that is possible?

how to display the PPT, PDF, XL, DOC files with in the Windows store app?

Hi,


I would like to display the PPT, PDF, XL, DOC files with in the Windows store app? is there any controls provided by Microsoft to view these files with in the app?


Or


Any workaround to achieve the desired functionality?


Kindly provide your inputs if any one has.


Regards


Prasad


How do I fill an Excel spreadsheet with the contents of a DataTable? (C#, OleDb)

Dynamic Value for Column

Hi, I have the following piece of code which produces this output:



SELECT

crs.HOSP_CODE,
DATEADD(DAY,1-DATEPART(DAY,crs.MONTH),CONVERT(date,crs.MONTH)) AS [MONTH],
crs.NO_REFERRALS,
crsx.NO_REFERRALS AS LAST_MONTH,
crs.NO_REFERRALS - crsx.NO_REFERRALS AS DIFF,
@LATEST_MONTH AS LATEST_MONTH,
@PREVIOUS_MONTH AS PREVIOUS_MONTH


FROM #CRS_REFERRALS1 AS crs
FULL OUTER JOIN #CRS_REFERRALS1 AS crsx ON crs.HOSP_CODE = crsx.HOSP_CODE AND crs.MONTH = DATEADD(MONTH,1,crsx.MONTH)


For reporting purposes How can I add a dynamic column so that it shows the latest no_referrals for the latest month and hospital chosen. In this case the latest month is March 2015 and hospital is FSH, so I would want my additional column to show the value 2592 on each row.


if the user was to select a date in January and two hospitals then I would want januarys value copied into each row for each respective hospital.


Dynamic Value for Column

SQL Server 2012 and onwards


SELECT <coolumns>,



LAST_VALUE(NO_REFERRALS) OVER (PARTITION BY code ORDER BY month DESC
ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) LstValue

FROM tbl




Best Regards,Uri Dimant SQL Server MVP, http://ift.tt/1iQ9JkR



MS SQL optimization: MS SQL Development and Optimization

MS SQL Consulting: Large scale of database and data cleansing

Remote DBA Services: Improves MS SQL Database Performance

SQL Server Integration Services: Business Intelligence


Dynamic Value for Column

Hi,


Try adding this as another column to your select list.



SELECT TOP 1 crs.NO_REFERRALS
FROM #CRS_REFERRALS1 AS xcrs
FULL OUTER JOIN #CRS_REFERRALS1 AS xcrsx ON xcrs.HOSP_CODE = xcrsx.HOSP_CODE AND xcrs.MONTH = DATEADD(MONTH,1,xcrsx.MONTH)
WHERE crs.HOSP_CODE=xcrs.HOSP_CODE
ORDER BY DATEADD(DAY,1-DATEPART(DAY,crs.MONTH),CONVERT(date,crs.MONTH)) AS [MONTH] DESC

Regards,




Gavin Clayton Claytabase Ltd www.claytabase.co.uk


Dynamic Value for Column

Hi lrj1985,



Regading your description, you are trying to add one more column which valueing the lastest Month for HOSP_CODE specifically, right? If my understanding is correct, you can reference the below code.




SELECT

crs.HOSP_CODE,
DATEADD(DAY,1-DATEPART(DAY,crs.MONTH),CONVERT(date,crs.MONTH)) AS [MONTH],
crs.NO_REFERRALS,
crsx.NO_REFERRALS AS LAST_MONTH,
crs.NO_REFERRALS - crsx.NO_REFERRALS AS DIFF,
@LATEST_MONTH AS LATEST_MONTH,
@PREVIOUS_MONTH AS PREVIOUS_MONTH,
cat.LatestMonth AS LatestMonth


FROM #CRS_REFERRALS1 AS crs
FULL OUTER JOIN #CRS_REFERRALS1 AS crsx ON crs.HOSP_CODE = crsx.HOSP_CODE AND crs.MONTH = DATEADD(MONTH,1,crsx.MONTH)
CROSS APPLY
(
SELECT MAX(DATEADD(DAY,1-DATEPART(DAY,[MONTH]),CONVERT(date,[MONTH]))) AS LatestMonth FROM #CRS_REFERRALS1 c WHERE c.HOSP_CODE = csr.HOSP_CODE
) AS cat



If you have any question, feel free to let me know.


Eric Zhang

TechNet Community Support




Select to Delete conversion

I have to convert the below select statement to Delete, can someone help me on this.



SELECT * FROM [Profile] TAB1
INNER JOIN
(SELECT [Col1] AS [ID],[Col2] AS [FileID]
FROM [SupData]
WHERE UPPER([DSet]) = N'TEST'
)TAB2
ON TAB1.[ID]=TAB2.[ID]
AND TAB1.[FileID] = TAB2.[FileID]



The Above select is giving me 2 records, I want write a script to delete them. the ID and FileID combination will always be unique




Neil



Select to Delete conversion

Hi Neil


Try this (in a test environment!)



delete tab1
FROM [Profile] TAB1
INNER JOIN
(SELECT [Col1] AS [ID],[Col2] AS [FileID]
FROM [SupData]
WHERE UPPER([DSet]) = N'TEST'
)TAB2
ON TAB1.[ID]=TAB2.[ID]
AND TAB1.[FileID] = TAB2.[FileID]




Select to Delete conversion

thanks Jmcmullen this works!


Neil


Select to Delete conversion


Merge [Profile] TAB1
Using (
SELECT [Col1] AS [ID],[Col2] AS [FileID] FROM [SupData]
WHERE UPPER([DSet]) = N'TEST'
) as TAB2
ON TAB1.[ID]=TAB2.[ID] AND TAB1.[FileID] = TAB2.[FileID]
WHen Matched
then Delete;


SSRS subreport configurations

How to call subreport in main report when subreport is being rendered as snapshot.


I am able to configure subreport in mail report when it is not running as a snapshot and getting the required results.


I am passing region and office as parameter to subreports and I have grouped the data in main report using region and office.


The moment I schedule the subreport to run as snapshot, it gives error in the main report.


Please help me with this issue


Reporting Services Registry access error

We have an existing setup of SQL 2014 & SP 2013 Foundation server which works fine without any issues. Then, we have been installed the following components into SQL Server



  • Reporting Services – SharePoint

  • Reporting Services Add-in for SharePoint


Then, I provisioned a new SQL Reporting Services Service Application in SharePoint.When attempting to Manage the Service Application and click on ‘System Settings’ in Central admin of SharePoint and getting below error.


The report server cannot decrypt the symmetric key that is used to access sensitive or encrypted data in a report server database. You must either restore a backup key or delete all encrypted content. ---> Microsoft.ReportingServices.Library.ReportServerDisabledException. The report server cannot decrypt the symmetric key that is used to access sensitive or encrypted data in a report server database. You must either restore a backup key or delete all encrypted content. --->System.Security.SecurityException.Requested registry account is not allowed.


I understand from my investigation, an above said error should thrown only if I'm changing the user of reporting services. But in my case, I Just installed Reporting services and trying to do the configuration. Not sure why I'm getting such registry access error.


Reporting Services Registry access error

what account is the SQL Server Reporting Services (MSSQLSERVER) service running under? open services.msc then go to the properties -> Log On tab. You may need to grant that service permissions to SharePoint, or use an account that has permissions to SharePoint and to the SSRS database or instance.

Monday, March 30, 2015

Windows 10 Registration of the app failed

Do you have installed the latest Build of Windows 10 with the number 10041?


Is your developer license up-to-date? Ensure you've network connection available and try to renew it via VS-Menu "Project->Store->Acquire Developer License"




Thomas Claudius Huber



"If you can't make your app run faster, make it at least look & feel extremly fast"



My latest Pluralsight-courses:

XAML Layout in Depth

Windows Store Apps - Data Binding in Depth



twitter: @thomasclaudiush

homepage: http://ift.tt/1fArvuE


Windows 10 Registration of the app failed

The latest build I can get is 9926, My developer account is up to date. I've VS2015 CTP 6 and I've also installed the Windows 10 Technical Preview Tools. When I try to acquire a Developer Licence it's working well but still the same issue after all.

Windows 10 Registration of the app failed

The latest build I can get is 9926,



It does say on the developer tools download page that you should have the 'latest flight' Windows 10 preview build, which is currently 10041. It doesn't explicitly say you need this version, but installing it might solve your issue (you can now download the ISO).


I'm a self-taught noob amateur. Please take this into account when responding to my posts or when taking advice from me.


Windows 10 Registration of the app failed

Hi,


Is build 10041 available to the slow ring as well? If yes then fine the tools should require it. If not then the tool should support 9926.


And if build 10041 is available on iso can you give a link?




-Shubhan


Windows 10 Registration of the app failed

Just update with Windows Update and it will be working.

Windows 10 Registration of the app failed

Same problem and I'm using HyperV.


Also when I try to use the designer edit the XAML I get an exception before the editor finishes loading




Calculate Business Hours

The code only looks at at the number of business days and then multiplies that number by 8(hrs), you're always going to return 8 given two values on the same date, no matter what the time portion of your datetime.


If you want a more granular solution, have a look at this:


http://ift.tt/1bKTozC


Different count

HI Zaim


Second query won't work (wrong syntax) where t.n=1 where s.status in ...


You might have entered the wrong code.






karepa


Parameter passing for dual condition for Stored Procedure


select * from student
where ((TestType = '1sem' and @sem='1sem')
or (TestType = '2sem' and @sem='2sem' )
or ((TestType in ('1sem','2sem') and @sem='dual' ))







Hope it Helps!!



Parameter passing for dual condition for Stored Procedure


declare @return as Table ( same structure as student )

if @TestType = "dual"
insert into @return ( columns )
select columns from student
else
insert into @return (columns )
select columns from Student
where TestType = @TestType


select * from @return;





karepa


Different count

What is the difference between these two quries why they returning two different count. can any one explain....

---1
select count(distinct (t.id)) FROM
(
select row_number() OVER (PArtition by s.sid order by s.sid)n, s.*
FROM sub s inner join payee p on s.sid= p.sid

where
s.status in ('A','B','C','D')
and s.productid in ('m','s')
and s.billingMethod='online'

) t where t.n=1

---2
select count(distinct (t.id)) FROM
(
select row_number() OVER (PArtition by s.sid order by s.sid)n, s.*
FROM sub s inner join payee p on s.sid= p.sid
) t where t.n=1
WHERE
s.status in ('A','B','C','D')
and s.productid in ('m','s')
and s.billingMethod='online'





http://ift.tt/11Y1wrq


Windows 10 Store Apps - Best way to get started?

Following link has tutorials to help get started. These tutorials cover developing apps using XAML and C#.


http://ift.tt/1nQnp3G



Windows 10 Store Apps - Best way to get started?

Go to Microsoft Virtual Academy and watch a few videos to get started.


I have a 'Hello World' Universal App article on my blog (http://ift.tt/1HZj2Ou). I explain the basics of working in Visual Studio.


And ask any questions you have in this forum.


You could stay away from XAML it first (by that I mean just use the visual designer and ignore the actual XAML code). But as a web developer you should pick up XAML easily. Windows 10 apps should be laid out similarly to websites to adapt to different screens.


Use C# over VB if you're deciding between the two. It's much harder to find help with VB, and C# is such a great language anyway.




I'm a self-taught noob amateur. Please take this into account when responding to my posts or when taking advice from me.


Converting Microsoft Access Reports to SQL Server

Hi Mark123321,


According to your description, you want to import Access reports to Reporting Services.


In Reporting Services, there is an Import Reports feature for us to import Access reports. When we use the import feature, all reports in the database or project file are imported. But we should notice that Reporting Services does not support all Access report objects.


Reference:

Import Reports from Microsoft Access (Reporting Services)

Importing Access Reports into SQL Server Reporting Services


If you have any question, please feel free to ask.


Best regards,

Qiuyun Yu




Qiuyun Yu

TechNet Community Support




IE browser strange behaviour

Hi,


(1) I have one user's IE can direct access the SQL reporting page without the login dialog box poped up. Although I already clear all the settings from his IE browser, the password dialog box still not shown. Chrome also didn't show the login dialog...


Adjust the width of the BCS WebPart's parameter

edit the web parts' properties, and manually set the width. Or put it in a zone that isn't as wide.


Scott Brickey

MCTS, MCPD, MCITP

www.sbrickey.com

Strategic Data Systems - for all your SharePoint needs


Adjust the width of the BCS WebPart's parameter

I already tried that, webpart becomes small but I still need to scroll in that small window until the right most part to find the Add.


I also tried modifying the css width: 300px; using a CEWB but it seems that the length of the textbox is being modified/reset to the original state (width is @ 100%).




----------------------- Sharepoint Newbie


Adjust the width of the BCS WebPart's parameter

Hi,


You can set the width using Jquery in the FilterValuesPickerDialog.aspx.


More information:


Jquery Width


Hope this will help.


Best Regards


Visual Studio Breakpoint not working

the issue is that your code (specifically the symbols) don't match any of the assemblies loaded within the process(es) that you're debugging.


Chances are, you just need to restart the debugged process (iisreset for w3wp, restart owstimer for timer service, etc)




Scott Brickey

MCTS, MCPD, MCITP

www.sbrickey.com

Strategic Data Systems - for all your SharePoint needs


Visual Studio Breakpoint not working

Hi Abhijit,


What type of development are you talking about? For instance, when developing Time Jobs, you need to attach the "OWSTimer" process...


XSLT compile error.

What is the error you getting? and which line?


Fouad Roumieh



XSLT compile error.

What is the error you getting? and which line?


Fouad Roumieh




Hi Fauad,


Thank you in advance for your help.


The screenshot shows the error:



XSLT compile error.

Also you can check this for a more readable version of your xsl:



<?xml version="1.0" encoding="utf-8"?>

<book>

<Item_Code>001</Item_Code>
<Item_Description>Tea</Item_Description>
<Current_Count>10</Current_Count>
<On_Order>20</On_Order>

</book>

XSL



<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://ift.tt/ore0Pe; version="1.0">

<xsl:template match="book">
<table width="100%">
<TR>
<TD>Item_Code</TD>
<TD>
<xsl:value-of select="Item_Code"/>
</TD>
</TR>
<TR>
<TD>Item_Description</TD>
<TD>
<xsl:value-of select="Item_Description"/>
</TD>
</TR>
<TR>
<TD>Current_Count</TD>
<TD>
<xsl:value-of select="Current_Count"/>
</TD>
</TR>
<TR>
<TD>On_Order</TD>
<TD>
<xsl:value-of select="On_Order"/>
</TD>
</TR>
</table>
</xsl:template>
</xsl:stylesheet>

Useful testing tool:


http://ift.tt/1boT3PS




Fouad Roumieh




XSLT compile error.

Thank you Fouad, that's very helpful. I need to output at least two styles to be viewed in a browser.


I am getting another error now:



The program isn't writing to my xml file. Any idea where I am going wrong? Thanks in advance for your help. Here is my code:



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Data.OleDb;
using System.Xml;
using System.Xml.Xsl;
using System.Xml.XPath;

namespace CSVImporter
{

public partial class CSVImporter : Form
{
//const string xmlfilename = @"C:\Users\fenwky\XmlDoc.xml"; - file name and location of xml file
const string xmlfilename = @"C:\Users\fenwky\XmlDoc.xml";

// New code
//const string xmlfilename = @"C:\Users\fenwky\XmlDoc.xml"; - file name and location of xsl file
const string stylesheetsimple = @"C:\Users\fenwky\style1.xsl";


//const string xmlfilecomplex = @"C:\Users\fenwky\XmlDoc2.xml";
const string xmlfilecomplex = @"C:\Users\fenwky\XmlDoc2.xml";

DataSet ds = null;


public CSVImporter()
{
InitializeComponent();
// Create a Open File Dialog Object.
openFileDialog1.Filter = "csv files (*.csv)|*.csv|All files (*.*)|*.*";
openFileDialog1.ShowDialog();
string fileName = openFileDialog1.FileName;


//doc.InsertBefore(xDeclare, root);
// Create a CSV Reader object.
CSVReader reader = new CSVReader();
ds = reader.ReadCSVFile(fileName, true);
dataGridView1.DataSource = ds.Tables["Table1"];

}

private void WXML_Click(object sender, EventArgs e)
{
WriteXML();
}

public void WriteXML()
{

StringWriter stringWriter = new StringWriter();
ds.WriteXml(new XmlTextWriter(stringWriter), XmlWriteMode.WriteSchema);
string xmlStr = stringWriter.ToString();
XmlDocument doc = new XmlDocument();
doc.LoadXml(xmlStr);
XmlDeclaration xDeclare = doc.CreateXmlDeclaration("1.0", "UTF-8", null);
XmlNode docNode = doc.CreateXmlDeclaration("1.0", "UTF-8", null);

doc.InsertBefore(xDeclare, doc.FirstChild);

// Load the style sheet.
XslCompiledTransform xslt = new XslCompiledTransform();
xslt.Load("style1.xsl");

// Transform the file and output an HTML string.
string HTMLoutput;
StringWriter writer = new StringWriter();
xslt.Transform("XmlDoc.xml", null, writer);
HTMLoutput = writer.ToString();
writer.Close();

var piText = "type=\"text/xsl\" href=\"style1.xsl\"";
var newPI = doc.CreateProcessingInstruction("xml-stylesheet", piText);
doc.InsertAfter(newPI, doc.FirstChild);

// Save document
doc.Save(xmlfilename);

}

private void btExportComplexXML_Click(object sender, EventArgs e)
{
WriteXMLComplex();
}

public void WriteXMLComplex()
{
// Creates stringwriter
StringWriter stringWriter = new StringWriter();
ds.WriteXml(new XmlTextWriter(stringWriter), XmlWriteMode.WriteSchema);

string xmlStr = stringWriter.ToString();

XmlDocument doc = new XmlDocument();
doc.LoadXml(xmlStr);

XmlDeclaration xDeclare = doc.CreateXmlDeclaration("1.0", "UTF-8", null);
XmlNode docNode = doc.CreateXmlDeclaration("1.0", "UTF-8", null);

doc.InsertBefore(xDeclare, doc.FirstChild);

// Create a procesing instruction.
// XmlProcessingInstruction newPI;
// Uses XML transformation.
// String PItext = "<abc:stylesheet xmlns:abc=\"http://ift.tt/1N6W08z; version=\"1.0\">";
// newPI = doc.CreateProcessingInstruction("xsl:stylesheet", PItext);
// doc.InsertAfter(newPI, doc.FirstChild);

// Try this code as
var piText = "type=\"text/xsl\" href=\"style1.xsl\"";
var newPI = doc.CreateProcessingInstruction("xml-stylesheet", piText);
doc.InsertAfter(newPI, doc.FirstChild);

// Saves document.
doc.Save(xmlfilecomplex);

}
}

//Creates a CSVReader Class
public class CSVReader
{

public DataSet ReadCSVFile(string fullPath, bool headerRow)
{

string path = fullPath.Substring(0, fullPath.LastIndexOf("\\") + 1);
string filename = fullPath.Substring(fullPath.LastIndexOf("\\") + 1);
DataSet ds = new DataSet();

try
{
if (File.Exists(fullPath))
{
string ConStr = string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0}" + ";Extended Properties=\"Text;HDR={1};FMT=Delimited\\\"", path, headerRow ? "Yes" : "No");
string SQL = string.Format("SELECT * FROM {0}", filename);
OleDbDataAdapter adapter = new OleDbDataAdapter(SQL, ConStr);
adapter.Fill(ds, "TextFile");
ds.Tables[0].TableName = "Table1";
}
foreach (DataColumn col in ds.Tables["Table1"].Columns)
{
col.ColumnName = col.ColumnName.Replace(" ", "_");
}
}

catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
return ds;
}
}
}


XSLT compile error.

@Kylee Fenwick


Just according to the error information,Please add XmlDoc.xml file to C:\Users\fenwky\documents\visual studio 2013\Projects\CSV Importer\CSV Importer\bin\Debug.


Best regards.


Kristin




We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.

Click HERE to participate the survey.


XSLT compile error.


@Kylee Fenwick


Just according to the error information,Please add XmlDoc.xml file to C:\Users\fenwky\documents\visual studio 2013\Projects\CSV Importer\CSV Importer\bin\Debug.


Best regards.


Kristin




We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.

Click HERE to participate the survey.



Kristin, when I click on the XML Simple button, the XML file should save to that location. The idea is that the program converts the CSV to xml, and uses style.xsl to style xml file that is readable via a browser. Where am I going wrong with my code?

How can I dynamically pass values to the DayOfWeek array given below?

I have this below code:



var onMondayAndTuesday = DailyTimeIntervalScheduleBuilder.Create()
.OnDaysOfTheWeek(new DayOfWeek[] { DayOfWeek.Monday, DayOfWeek.Tuesday });

var trigger = TriggerBuilder.Create()
.StartAt(DateBuilder.DateOf(StartHour, StartMinute, StartSeconds, StartDate, StartMonth, StartYear))
.WithSchedule(onMondayAndTuesday)
.WithCalendarIntervalSchedule(x => x.WithIntervalInWeeks(Int32.Parse(nWeekInterval)))
.EndAt(DateBuilder.DateOf(0, 0, 0, EndDay, EndMonth, EndYear))
.WithIdentity(triggerKey)
.Build();

Here depending on the days users have selected any weekday would be passed in to the DaysOfWeek array. It might be just monday or monday and friday etc. How can I achieve this? Please advice.



mayooran99


Issue with CDC and Replication enabled

Hello,


We have this strange issue with CDC and replication. Let me explain


1. We have a database on write server and we replicate some tables to the read server. There are 15 tables that we replication and 8 of them have computed columns that are persisted.


2. We also have CDC enabled on the same database where we have transactional replication enabled. I know that both CDC and replication uses replication log reader. Some how, all the time we see the log_reuse_wait says replication


3. If I add around 100-200 MB into these tables, with these persisted columns, it will be around 500 MB of data. But the replication is queuing up 10-15 GB of data.


4. I checked CDC tables, and the updates are in cdc tables. Also, I don't see CDC capture job. Is this because there is already replication enabled?


What might be the issue that's causing the log to hold for a very long extended periods of time? We don't see any issue with log reader and CDC.


C#, NULL com port

my C# program will not pick up the Null com port on a windows 2008 R@ Server, stand-alone. but this same code work on other computers... why ?



public Form1()
{

InitializeComponent()
_serialPort.DataReceived += new SerialDataReceivedEventHandler(DataRecivedHandler);

foreach ( sting s in SerialPort.GetPortNames())
{
comport.Items.add(s);
}

}


C#, NULL com port

1. You didn't show how to declare SerialPost.


2. You didn't show how you implement your GetPortNames().


chanmm




chanmm


C#, NULL com port


C#, NULL com port

I get com1 and com2...


I just do not see what null com is not coming up


C#, NULL com port


I get com1 and com2...


I just do not see what null com is not coming up



Sorry for the late response.


As the documentation says, the SerialPort.GetPortNames method retrieves the port names from the registry, and from the picture in your previous post, there're only two ports(COM1 & COM2), if you got COM1 and COM2, the result is correct.


So what do you mean by "null com"? If you mean the virtual ports shown in the program "com0com", I think you need to get rid of SerialPort.GetPortNames method. Try other Windows APIs in the link of my last reply.




We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.

Click HERE to participate the survey.


SSRS: Setting Header from Top/Footer from Bottom

Hello there guys


We're using RDLC-Files to create some word reports.


In our previous version, where we used RDL-Files on SQL 2008 R2, the Margin-Properties (Header from Top / Footer from Bottom) didn't get set at all an was always 0.


This behaviour was reported, but marked by Microsoft as 'By design'. Since I can't post a link, just google for


"Word export sets margin-top, margin-bottom to 0mm".


Interesting enought, on our new Version with RDLC, this properties are always set to 1.27cm, but ignore the Margin-Properties of the Report-Page at all.


Since we'd like to port our reports from the old RDLs to the new RDLCs, it would be the easiest way, if we could kindahow set these two properties.


But so far I didn't find a possiblity. Is there one, to tell the Word-Renderer what we'd like to set there?


Thanks in advance


Matthias Müller


SSRS: Setting Header from Top/Footer from Bottom

Hi,


It should by design.




Work hard, play harder!


How to restructure this code into separate classes?

But you can and imho should separate the visualization from the device handling (SEP - Single responsibility principle). See also SOLID.

How to restructure this code into separate classes?

Hi Kristin,


the question is placed here well, cause it's about how to structure code in general..


How to restructure this code into separate classes?


Hi Kristin,


the question is placed here well, cause it's about how to structure code in general..



Thanks Stefan, I got it.




We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.

Click HERE to participate the survey.



PreAuthenticate does not work on CredentialCache.DefaultNetworkCredentials

Hi,


I would like to know why PreAuthenticate=true does not work if i use the CredentialCache.DefaultNetworkCredentials. Is it any reason for this. I'm using .net 2.0 web and consume to the wcf web service. I want to reduce the authentication time that why i plan to use PreAuthenticate=true at my asp.net. But it does not work and keep checking authentication when i call the web services.

wcf web service support ntml and Kerberos. I can't use user and password. I can use default credential only for my requirement.

Is it something wrong on my test or not support?





Regards,



Here is my test code snap.



HttpWebRequest req;
WebResponse resp;
string url = "http://thirpartysystem:7047/SystemService";

NetworkCredential _Cred;
CredentialCache credCache = new CredentialCache();
_Cred = CredentialCache.DefaultNetworkCredentials;

credCache.Add(new Uri(url), "Negotiate",
_Cred);
req = (HttpWebRequest)WebRequest.Create(url);
req.PreAuthenticate = false;
req.Credentials = credCache;
resp = req.GetResponse();
if (req.HaveResponse)
resp.Close();

req = HttpWebRequest.Create(url) as HttpWebRequest;
req.PreAuthenticate = true;
req.Credentials = credCache;
resp = req.GetResponse();
if (req.HaveResponse)
resp.Close();
//Result is
//401
//401
//200
//401
//200

_Cred = new NetworkCredential("user", "password", "domain");
credCache.Add(new Uri(url), "Negotiate",
_Cred);
req = (HttpWebRequest)WebRequest.Create(url);
req.PreAuthenticate = false;
req.Credentials = credCache;
resp = req.GetResponse();
if (req.HaveResponse)
resp.Close();

req = HttpWebRequest.Create(url) as HttpWebRequest;
req.PreAuthenticate = true;
req.Credentials = credCache;
resp = req.GetResponse();
if (req.HaveResponse)
resp.Close();

//Result is
//401
//200
//200





Make Simple & Easy


GUID in Path of Catalog Table

I have some SSRSreports on a Sharepoint Site.


In Catalog table of the report server database, part of the path is stored as GUID.


Does anyone know how to determine the actual path of the reports?


Thank you.


GUID in Path of Catalog Table

Hi miguelh,


According to your description, you want to find the actual path of the reports in SharePoint site.


In SharePoint integrated mode, report server items are always stored in libraries or in a folder within a library. In your scenario, since the path of the reports is stored as GUID, then you should go to SharePoint site to see the libraries and the content of the selected library in Browse page, then to find the actual reports. Besides, we do not document or support querying any Report Catalog tables.


Reference:

Viewing and Managing Report Server Items from a SharePoint Site


If you have any question, please feel free to ask.


Best regards,

Qiuyun Yu




Qiuyun Yu

TechNet Community Support




Using a Look up in a matrix

Right actually easy but took forever to find.


Just concatenate the two fields. Example:


=lookup(Fields!Mnth.Value+Fields!text.Value,Fields!Mnth.Value+Fields!text.Value,Fields!Calls.Value,"Compliments_SN")


Using a Look up in a matrix

Hi KMoff,


Glad to hear your problem have been resolved and your sharing will help others a lot!


Regards,

Vicky Liu




Vicky Liu

TechNet Community Support




Event receiver listadding and access the list

Thanks Patrick for the help.


I need to use an event receiver. Because the problem is the solution must run in different SharePoint 2010 farms. On each farm the content type was created manually and has not a unique GUID.


Regards


Stefan



Using a Look up in a matrix

Right actually easy but took forever to find.


Just concatenate the two fields. Example:


=lookup(Fields!Mnth.Value+Fields!text.Value,Fields!Mnth.Value+Fields!text.Value,Fields!Calls.Value,"Compliments_SN")


Drill down group level in SSRS

Hi Friends,


I have a requirement where i am converting a Crystal report into SSRS.


My data contains different groups where some of the sections should be suppressed based on Drill down group level.In crystal they are using DrillDownGroupLevel <> 1 . Can some one help me with the relevant function in SSRS.


Thanks,


Sam


Drill down group level in SSRS

Hi Prasad,


Thanks for the info.As per my understanding i have applied toggle on particular field to enable drill down but not sure how to use it in visibility based on Drilldown level.


I am bit confused here.Can you explain me bit further.Thanks for your patience.


Sam


Drill down group level in SSRS

Hi Samhith,


Per my understanding that you want to create the drill down report in SSRS, right?


Add the drilldown action, you can show or hide static rows and columns, or rows and columns that are associated with groups.


Please take reference to the details steps about how to create an drilldown report(Sample):



  1. Add an row group in the report(CarMake1)

  2. Right click the "Details" under the row group and select the "Group Properties".


  3. Click the "Visibility" on the left pane and setting as below(The setting means that by default the details row will be hide and you can click the toggle on the row group(CarMakes1) to display the details):



    Note: You can also do the same setting on the child group and when click the toggle on the parent group will display the content of the child group.


More details information in the article for your reference:

DrillDown Report in SSRS

Drilldown Action (Report Builder and SSRS)


If you still have any problem, please feel free to ask.


Regards,

Vicky Liu




Vicky Liu

TechNet Community Support




custtom settings for my SP site without using a list or having access to the farm/server?

Thanks!

Problem to create the site

Thanks. I try to put the following





to create the Team site but I don't know why I get this





Many Thanks & Best Regards, Hua Min


Crystal Report Using C#

i want example application in c# based on the duplicate detection alogrithm

These forums are not intended to help with cheating homework.


Success

Cor


count is very slow

table Structure is


(


ID bigint primary key,


Name Nvarchar(50)


);


record 50 millions


Query SQL


SELECT COUNT(ID) FROM U WHERE Name = '';


Query Time: over 3 minute


First time is very slow


How is Fast in first time???



count is very slow

Can add index of Nvarchar???

count is very slow

Can add index of Nvarchar???

Yes, you can add a non-clustered index on the 'Name' NVARCHAR COLUMN

count is very slow

How Create?? How Write SQL??

count is very slow



CREATE INDEX IX_U_Count ON U(ID) INCLUDE (NAME)

Useless.


still of over 3 minute


count is very slow



CREATE NONCLUSTERED INDEX NCFIX_Table1_Test01
ON Table1 (ID)
WHERE Name='';
GO



Try with this one and share with us execution plan


Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it


Sunday, March 29, 2015

SQL Server Policy Management !

Below are some what we use:



Data file free space falls below 10% free space

Auto shrink is OFF

AUTO CLOSE is OFF

Backup Files Must Be on Separate Devices from the Database Files

Place Data and Log Files on Separate Drives

Check Integrity of Database with Suspect Pages


http://ift.tt/1a9ymui


The handle is invalid error exception when screenshoot from screen why and how to solve

Thank you for reply


can any one help me in answering this question


Get nth number of sets from user in proper set format in C#

Try this



List<List<string>> sets = new List<List<string>>() {
new List<string>() {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"},
new List<string>() {"11", "12", "13", "14", "15", "16", "17", "18", "19", "20"},
new List<string>() {"21", "22", "23", "24", "25", "26", "27", "28", "29", "30"},
new List<string>() {"31", "32", "33", "34", "35", "36", "37", "38", "39", "40"},
new List<string>() {"41", "42", "43", "44", "45", "46", "47", "48", "49", "50"},
new List<string>() {"51", "52", "53", "54", "55", "56", "57", "58", "59", "60"},
new List<string>() {"61", "62", "63", "64", "65", "66", "67", "68", "69", "70"},
new List<string>() {"71", "72", "73", "74", "75", "76", "77", "78", "79", "80"},
new List<string>() {"81", "82", "83", "84", "85", "86", "87", "88", "89", "90"},
new List<string>() {"91", "92", "93", "94", "95", "96", "97", "98", "99", "100"}
};


List<string> output = sets[3].ToList();





jdweng


Get nth number of sets from user in proper set format in C#

Joel it's hard coded set . My requirment is User enter sets on run time

Get nth number of sets from user in proper set format in C#

No difference.



List<List<string>> sets = new List<List<string>>();

for (int rowCount = 0; rowCount < 100; rowCount += 10)
{
List<string> newRow = new List<string>();
sets.Add(newRow);
for (int colCount = 1; colCount <= 10; colCount++)
{
newRow.Add((rowCount + colCount).ToString());
}
}


List<string> output = sets[3].ToList();





jdweng


Get nth number of sets from user in proper set format in C#

I think you still not got my point. okay once again i explain you what i want.



  • User Enter set in WPF window in this format e.g {1,2,3,ab},{ab,cd,1,2}.

  • User can enter nth number of set.

  • User can enter nth number of elements\ items in each set.

  • Count the number of elements in each set.


Hopefully now you got my point


totals in last page

Hi Stephen


Hope this is what you wanted. Please check the link below


http://ift.tt/1BCdPUy


hope this helps


Thanks


Bhanu


checks if item field link exists into a custom list

Hi


An easiest way without coding:


create separate 2 columns for URL and description


set them as unique


next create a new caulcuated column as URL+DESCRIPTION




Romeo Donca, Orange Romania (MCSE, MCITP, CCNA) Please Mark As Answer if my post solves your problem or Vote As Helpful if the post has been helpful for you.


Datetime

Hi,


I want to get 15th of the last month and 15th this month using transact SQL. Any suggestions?




-kccrga http://ift.tt/1lLux0g


Pruning text box contents: Ideas?

I agree with Joel. You want to delete whole lines, not arbitrarily delete fractions of lines, and a listbox would be the best tool for this task.


However, if you must use a textbox for some reason, then you can get and set the Lines property.


How to restructure this code into separate classes?

But you can and imho should separate the visualization from the device handling (SEP - Single responsibility principle). See also SOLID.

Update records from a table in correct sequence that look from 2 tables and loop

Hi!


Thanks.


Regem


totals in last page

Hi Stephen


Hope this is what you wanted. Please check the link below


http://ift.tt/1BCdPUy


hope this helps


Thanks


Bhanu


How can I get the date of the next monday from the currentday?

This should help:


http://ift.tt/1GFr3Xh


There is a generic form of that routine presented in that post.


Saga




You can't take the sky from me


StaticResource not working

Can you post a full project to let me have a test?

StaticResource not working

This property is not supported in Windows 8.1. You can not use it.

C# Parsing JSON data within Mobile project OR via Controller Issue

When I invoke the following to a custom controller to return data to my client (Windows Phone 8.1 app):



var _lines = await App.MobileService.InvokeApiAsync<List<Tfl.Api.Presentation.Entities.Line>>("lines", System.Net.Http.HttpMethod.Get, new Dictionary<string, string>
{
{"url", "http://ift.tt/19qNGRY;}
});





I received the following Exception:-



FileNotFoundException was caught
Could not load file or assembly 'System.Runtime.Serialization,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one
of its dependencies. The system cannot find the file specified.

However, I successfully parse the JSON data via the controller [I did have an image here displaying the data, but not enough rep to post!] and I also have no references to the above dll in my Windows Phone application.


Any ideas?


Note: Occurs using either local parsing within the mobile app or via controllers in a service app; also running VS Ultimate 2013 with Update 4



C# Parsing JSON data within Mobile project OR via Controller Issue

Hi davidcrossey,


As I understand from your description, looks like the Windows Phone does give exception while the Serizlication object is passed here, but totally works fine on JSON data, is that correct?


Base on the Exception I think you may also check what .net version of serialization, as I know Windows Phone 8.1 use .Net 4.5 but the assembly you are missing seems from 4.0, would you double check it? Or perhaps the service side is still using 4.0.


--James




We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.

Click HERE to participate the survey.


SSRS Report is jumbled up

Can you try arranging the textboxes inside a rectangle and then apply the group? that will make sure position and spacing remains consistent


Please Mark This As Answer if it solved your issue

Please Vote This As Helpful if it helps to solve your issue

Visakh

----------------------------

My Wiki User Page

My MSDN Page

My Personal Blog

My Facebook Page


Pruning text box contents: Ideas?

Hi all,


I've got a text box in a C#2010 app that I use as a console. The user enters commands here and the app dumps what ever results are generated into this text box also. After doing some serious testing the text box seemed to stop responding by not allowing any more characters to be entered. After some research I found that the max length of the text box, in how many characters can be out into it, is 32K.


I am working on how to resolve this. I would like to monitor the text box length and when it reaches about 85% capacity I would like to prune its contents. I do not want to clear it because it may contain information that the user might want to see again. I would like to take 80% from the top and remove that, keeping intact the bottom 20%.


I do not have a problem monitoring the text box or identifying the exact text to remove, but would like some help in determining the best way to remove the text. This will be a large amount of text and would like to know which is the most effective way to do this. I could do something like this:



textbox.text = textbox.text.substring(iStartKeeptextPos);



But, is this really the optimized way to do it? As always, thank you for your help. Saga




You can't take the sky from me


Read Excel File to String Question

How do you read an excel file and get an specific cell written to a string ?

Read Excel File to String Question

Hi,


Use below code using OledDB.



string PATH = @"c:\MyCode\ExcelSheetName.xlsx";
string connection= "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + PATH + ";Extended Properties=Excel 12.0";

OleDbCommand cmd = new OleDbCommand("SELECT Column1 FROM [sheet1$] WHERE columnid=1 , connection);

string strValue = cmd.ExecuteScalar().ToString();





PS.Shakeer Hussain


Read Excel File to String Question

Try this office API,add the following code can get the string:



Workbook workbook=new Workbook();
workbook.LoadFromFile("test.xlsx");
Worksheet worksheet=workbook.Worksheets[0];
string str = worksheet.Range["A1"].Value.ToString();
Console.WriteLine(str);
Console.ReadKey();




Read Excel File to String Question

Hi vkid12,


Please try and test the following code, It works fine on my side.



private void button1_Click(object sender, EventArgs e)
{
Microsoft.Office.Interop.Excel.Application xlApp;
Microsoft.Office.Interop.Excel.Workbook xlWorkBook;
Microsoft.Office.Interop.Excel.Worksheet xlWorkSheet;
Microsoft.Office.Interop.Excel.Range range;

string str;
int rCnt = 0;
int cCnt = 0;

xlApp = new Microsoft.Office.Interop.Excel.Application();
xlWorkBook = xlApp.Workbooks.Open(@"D:\C# Repro\Winform\ReadExcel\ReadExcel\bin\Debug\test111.xls", 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
xlWorkSheet = (Microsoft.Office.Interop.Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);

range = xlWorkSheet.UsedRange;
//you can get specific cell
for (rCnt = 1; rCnt <= range.Rows.Count; rCnt++)
{
for (cCnt = 1; cCnt <= range.Columns.Count; cCnt++)
{
str = (string)(range.Cells[rCnt, cCnt] as Microsoft.Office.Interop.Excel.Range).Value2;
MessageBox.Show(str);
}
}

xlWorkBook.Close(true, null, null);
xlApp.Quit();

releaseObject(xlWorkSheet);
releaseObject(xlWorkBook);
releaseObject(xlApp);

}

private void releaseObject(object obj)
{
try
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(obj);
obj = null;
}
catch (Exception ex)
{
obj = null;
MessageBox.Show("Unable to release the Object " + ex.ToString());
}
finally
{
GC.Collect();
}
}



Best regards,


Kristin




We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.

Click HERE to participate the survey.


Read Excel File to String Question

Hi vkid12,


Another way using OLEDB read data from excel



private void button2_Click(object sender, EventArgs e)
{
string PATH = @"D:\C# Repro\Winform\ReadExcel\ReadExcel\bin\Debug\test111.xls";
string connection = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + PATH + ";Extended Properties=Excel 12.0";
OleDbConnection connExcel = new OleDbConnection(connection);
connExcel.Open();
List<string> result = new List<string>();

DataTable xlsData = new DataTable();
OleDbDataAdapter dbAdapter = new OleDbDataAdapter("select * from [Sheet1$] WHERE ID <= 6 ", connExcel);
dbAdapter.Fill(xlsData);// the data are in datatable, you could filter what you want

}



Best regards,


Kristin




We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.

Click HERE to participate the survey.


Read Excel File to String Question


Hi vkid12,


Another way using OLEDB read data from excel



private void button2_Click(object sender, EventArgs e)
{
string PATH = @"D:\C# Repro\Winform\ReadExcel\ReadExcel\bin\Debug\test111.xls";
string connection = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + PATH + ";Extended Properties=Excel 12.0";
OleDbConnection connExcel = new OleDbConnection(connection);
connExcel.Open();
List<string> result = new List<string>();

DataTable xlsData = new DataTable();
OleDbDataAdapter dbAdapter = new OleDbDataAdapter("select * from [Sheet1$] WHERE ID <= 6 ", connExcel);
dbAdapter.Fill(xlsData);// the data are in datatable, you could filter what you want

}



Best regards,


Kristin




We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.

Click HERE to participate the survey.



what namespace assembly do I need to use?

Read Excel File to String Question


Try this office API,add the following code can get the string:



Workbook workbook=new Workbook();
workbook.LoadFromFile("test.xlsx");
Worksheet worksheet=workbook.Worksheets[0];
string str = worksheet.Range["A1"].Value.ToString();
Console.WriteLine(str);
Console.ReadKey();





What assembly or namespace do I use?