[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x

.NET Programming

133K

Solutions

39K

Contributors

The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.

Share tech news, updates, or what's on your mind.

Sign up to Post

We're trying to build a datagrid connected to an SQL database in UWP as a proof of concept. We're running into an issue declaring the DataTemplate that it doesn't understand the DataType, and I can't get it to process it properly. This has to be defined as we're binding the textboxes to the SQL database. We were using this site for reference https://docs.microsoft.com/en-us/windows/uwp/data-access/sql-server-databases    (we've made changes to suite our needs)

Code segment throwing errors
<DataTemplate x:DataType="local:Product">

The.xaml page with the errors (line 48)
<Page
    x:Class="App3.Views.TicketsPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    Style="{StaticResource PageStyle}"
    mc:Ignorable="d">

    <Grid x:Name="ContentArea">
        <Pivot
            x:Name="Items">
            <PivotItem Header="Open">
                <Grid Background="{ThemeResource SystemControlPageBackgroundChromeLowBrush}">
                    <RelativePanel>
                        <ListView Name="WorklogList"
                            SelectionMode="Single"
                            ScrollViewer.VerticalScrollBarVisibility="Auto"
                            ScrollViewer.IsVerticalRailEnabled="True"
                            

Open in new window

0
Exploring ASP.NET Core: Fundamentals
LVL 12
Exploring ASP.NET Core: Fundamentals

Learn to build web apps and services, IoT apps, and mobile backends by covering the fundamentals of ASP.NET Core and  exploring the core foundations for app libraries.

I have created a webapi using asp.net core, which uses token based authentication, all DB operations get implemented in the webapi, i also have roles set at the web api, i am able to send username and password from client to webapi and retrieve the token, i also need to get the role associated with account at the client and i want to use this role in Authorize attribute for methods, the Authroize is not working, i think the roles are not being read at the client. Can you assist.
0
We have a site and it has a global search feature which is very very slow. It looks up 4 tables and does a wildcard.

This is how it looks like
select ....
 from 
 [dbo].[Unit] AS u
	LEFT join [dbo].[Schedule] AS s
    ON u.[ScheduleID] = s.[ID]
    LEFT OUTER JOIN [dbo].[MasterLease] AS m
        ON s.[MasterLeaseID] = m.[ID]
		INNER JOIN dbo.Portfolio p ON p.ID = m.PortfolioID
 
WHERE 
u.[Deleted] <> 1
          AND (1 <> s.[Status])
   
          AND (m.[Deleted] <> 1)
          AND (m.[Active] = 1)
AND
      (
          (s.[Sched] LIKE @searchtext)
          OR (u.[SerialNo] LIKE @searchtext)
        
          OR (u.[CustomerRef] LIKE @searchtext )
          OR (u.[Model] LIKE @searchtext )
          OR (u.[Manufacturer] LIKE @searchtext)
          OR (u.[SiteAddress] LIKE @searchtext )
          OR (m.[CustomerName] LIKE @searchtext )
          OR (s.[LesseeName] LIKE @searchtext )
      );

Open in new window


1. My manager doesn't want to do a FullText Search
2. We have used indexes
3. The wildcard slows down the search, I think
4. If I join the 4 tables without the where clause, I get 2,827,623 rows. Should we dump this data in a table and just search this table? (update the table every night with fresh data)
5. Tried this as well... I broke down the joins by creating temp tables. First search Units, dumped in the temp table, #Units. Then Schedules in #Scheudles , then MasterLease in #ML.  Then did the join like I have above but what if there's nothing in #Units table...meaning...search didn't bring anything back from and #units is empty. I don't the join going to be correct.

I think #4 is a good option. How do others do a global search?
0
Dear All,
I have a problem with a customized Windows based application which is developed in .NET.

It is a conversion application used to transliterate text in romanized format into native languages viz. Chinese, Urdu and the like; using the font Arial Unicode MS which follows the Unicode Standard. The conversion used to take place correctly until recently when we changed our operating system from Windows Server 2003 to Windows Server 2008 r2.

Interestingly, a bizzare event is happening. Suppose we want to translitereate Romanized script into two languages A and B. Using the application If we transliterate language A first then it gets converted correctly. After that language B converts incorrectly. Following it in second attempt after re-running the application if we transliterate language B first, it gets converted correctly following it with Language A, conversion gets inccorect.
0
Hello Folks,

I'm expanding my knowledge in learning classes in powershell... I have written this basic  PS example

class Books {
    [string]$title 
    [string]$author
    [int]$pages   
}

$books1 = [books]::new()
$books1.title = "Harry Potter"
$books1.author = "JK Rowling"
$books1.pages = 309

$books2 = [books]::new()
$books2.title = "Scott Pilgrim vs. the World"
$books2.author = "Bryan Lee O'Malley"
$books2.pages = 168

$books2 | ? {$_.title -like "*scott*"}

Open in new window


this will display the book from book 2 titled like "scott"...
Does anybody have any idea on how can I tell the program to search within all the books and find any "X" Title... I was thinking "foreach" but i'm not sure I could squeeze it in...? or if you have a c# approach that would be great also :)

Thanks in advance!
0
I'm following this example https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-web-api?view=aspnetcore-2.1
to learn .Net Core.

I know LINQ to SQL is not supported in .Net Core. Is LINQ to Entities (LINQ to Entities ) supported? is my only option is to use Entity Framework?

(I really liked LINQ to SQL. Too bad it's not supported)
0
Hi Expert
I have added the web service to the Class Library file and created the DLL file.
so my issues are when I added to another project to this DLL file the web services classes method is can call from DLL file.
I need to hide the web service method from the new project. I need to allow only a few methods I have created.
How to do that.if any idea much appreciated.
0
Hello Experts,
I am trying to generate an output file using StreamWriter in C# which contains Credit Card (CC) numbers.  As long as the CC Number is 15 digits long, the StreamWriter works just fine.  But when the CC Number length is 16 digits long, the StreamWriter replaces the last digit with 0 (zero).  Any idea how to fix it?  Please try to help.

Thank you very much in advance!
0
I have legacy code in C#, Web Forms and LINQ to SQL.

I want to upgrade this code and I want to move the data layer to ASP.Net Web API. I found this link
https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-web-api?view=aspnetcore-2.1

I wanted to keep LINQ to SQL code (DBML) to make the upgrade go faster. Looks like LINQ to SQL is not supported in .Net Core.L2S not supported lin

What should I do? I have DBML, stored procs. How can I do my upgrade?
0
These two lines of vb6 code I am trying to translate to C#:

mskFromDate.Text = Format(Date - TimeSerial((iNumDaysBefore * 24), 0, 0), "Short Date")
    mskToDate.Text = Format(Date + TimeSerial((iNumDaysAfter * 24), 0, 0), "Short Date")

I have this so far. I know it is not right.

var dt = string.Empty;
                dt = Convert.ToString(DateTime.Now.ToOADate() - (NumDaysBefore * 24));
                this.dtFromDate.Text = Convert.ToDateTime(dt).ToShortDateString();

Anybody have thoughts? I can't believe in vb6 they let folks subtract dates and numbers.
0
Why Diversity in Tech Matters
LVL 12
Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

When I try to run a web application in Visual Studio I get the following error.  It's only occurring with one web application.  Why?  How do I fix???

Unable to connect to the configured development Web server.

Output from IIS Express:
Failed to register URL "http://localhost:1789/"
The process cannot access the file because it is being used by another process. (0x80070020)

Here's my Visual Studio configuration:
Microsoft Visual Studio Professional 2017 
Version 15.8.9
VisualStudio.15.Release/15.8.9+28010.2050
Microsoft .NET Framework
Version 4.7.03190

Installed Version: Professional

Visual C++ 2017   00370-10200-04031-AA118
Microsoft Visual C++ 2017

Application Insights Tools for Visual Studio Package   8.13.10627.1
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2017   15.8.05085.0
ASP.NET and Web Tools 2017

ASP.NET Core Razor Language Services   15.8.31590
Provides languages services for ASP.NET Core Razor.

ASP.NET Web Frameworks and Tools 2017   5.2.60618.0
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0   15.8.05023.0
Azure App Service Tools v3.0.0

C# Tools   2.9.0-beta8-63208-01
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools   1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

ConvertToDevExtremeCommand Extension   1.0
ConvertToDevExtremeCommand Visual 

Open in new window

0
I am using Microsoft.Extension.Logging.Log4Net.AspnetCore.
I want to separate default framework logoutput into a separate file from the logoutput that I program the application to output.

Is this possible, and how?
0
try{
			
			previouslyTaken = new DataDAO().testForPkgPreviouslyTaken(this....., TimeStamp);//gives true or false boolean value
		}
		catch (XYZExceptionException xyze)
		{
			if(xyze.getMessage().contains("999"))
			{
				LOGGER.error("item is PreviouslyTaken due to aa", xyze);
				errorCodes.add(XYZConstants.PREVIOUS_TAKEN_EXISTS);				
			}
			else if(xyze.getMessage().contains("888"))
			{
				LOGGER.error("item is PreviouslyDumped due to bb", xyze);
				errorCodes.add(XYZConstants.PREVIOUSLY_DUMPED);
			}
			else
			{
				throw new XYZException(xyze);
			}	
			return ;
		}
		LOGGER.info("previouslyTaken indicator from DB {}",previouslyTaken); //coming false t me
		
		if(!previouslyTaken){
		processIt();
		else
		LOGGER.info("item taken or dumped so update status to new)

Open in new window


i have above code in a method.

i never saw if else inside a catch in earlier.

why some one use if else inside catch
when the catch is thrown as try block simply return true or false

when it has 999 or 888 etc value in the xyze exception

please advise
0
Hi Guys,
I am using asp.net mvc application with VB.net and I am trying to zip files and stream them back to the user to download.

Here is what I am doing
   Public Function DownloadFiles(attachmentsSelected As String) As ActionResult
        Dim obj As FileDownloads = New FileDownloads()
        ''get file list of files to download
        Dim filesCol = obj.GetFile(attachmentsSelected).ToList()

        Using memoryStream = New MemoryStream()
            Using ziparchive = New ZipArchive(memoryStream, ZipArchiveMode.Create, True)

                For i As Integer = 0 To filesCol.Count - 1
       //get the error here   ziparchive.CreateEntryFromFile(filesCol(i).FilePath + "\" + filesCol(i).FileName, filesCol(i).FileName, CompressionLevel.Optimal)
                Next
            End Using

            Return File(memoryStream.ToArray(), "application/zip", "Attachments.zip")
        End Using

    End Function

Open in new window


The issue with this code is when I am trying to download large file ...let's say 500mb I get an exception.

"Exception of type 'System.OutOfMemoryException' was thrown."

Any idea how can I fix this issue.

Thank you.
0
Hi,
I have a batch file as below:
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\VsDevCmd.bat"
cd C:\AutomationTestSamples\AutomationTestSamples\bin\Debug
start cmd /k vstest.console.exe AutomationTestSamples.dll /Logger:trx;LogFileName=%1/UnitTest1.trx /testcasefilter:FullyQualifiedName~AutomationTestSamples.UnitTest1.trx

Open in new window


I want to read a batch file line by line and if the line contains "UnitTest1.trx",
I want to replace "/testcasefilter:FullyQualifiedName~AutomationTestSamples.UnitTest1" with "/test".

I tried the following code but when I opened the file nothing was replaced.  Any idea please?
string[] str = File.ReadAllLines(@"C:\Test\test.bat");
            for (int i = 0; i < str.Length; i++)
            {
                if (str[i].Contains(trxName))
                {
                    str[i].Replace(str[i].Substring(str[i].IndexOf("/testcasefilter")), "/test");                    
                }
                
            }

Open in new window

0
Question in regards to upgrading exchange 2013 CU17 to CU21
Has anyone heard of not being able to upgrade from exchange 2013 CU17 directly to CU 21?
Someone told me that you had to go from CU17 to CU20 because of a .net issue then go to CU21
Is this correct or is this not correct?
Basically has anyone gone from CU17 directly to CU21?
Thanks
0
Hi,
We have a DB driven application where all the business logic written in Microsoft SQL.
We need to create a bunch of dynamic PDFs (Fillable PDFs) as a result of the calculations. We are now creating the PDF using .Net API and PHP.
Is there any easy way to create the PDF using SQL Reporting Services or any other ways?
Once the PDF is generated, we will use Angular ng pdf viewer to show the preview in browser.
Please help?

Thanks in advance :)
0
Hi All,
I have a C# DLL which was written for me to interface with my VB6 program.  The DLL is COM-Visible and the Register for COM interop selected.  The DLL has 3 methods Initialization, Up and Dn.

I have a small VB6 test program which access the DLL.

I'm using VS 2017 (run as administrator) to build the DLL
I have Visual Studio (VB6) on the same machine - A Windows 10 PRO system.

In my VB program I have a reference to the DLL (actually the TLB).  Intellesense works fine - I can see all three methods.
My startup code is:
Public Sub Main()
    Dim AM as AudioManager
    Set AM = New AudioManager       ' <<<==== Error here
  
End Sub

Open in new window

When I run the program I get an error at the Set statement - Runtime 429 - "ActiveX component can't create object".
I've done quite a bit of research on the web about this, and most of the similar issues are when someone tries to move a project from a development environment.  In my case , I'm getting this on the development system.
I have tried:
Tlbexp AM.DLL /out:AM.tlb
Regasm /tlb:AM.tlb AM.DLL
Gacutil /i AM.DLL
So far nothing seems to work.  I have put the DLL and TLB into the System32, SYSWOW64 and my VB6 application folders (registering it in each after removing from the previous location) - doesn't help.
Anyone have any ideas?
Thanks in advance
0
Is there a way to reprogram a shortcut icon so users cannot pin it to the taskbar on Windows 7?  I found this link where you can disable pinning for a certain string, but I don't want to include that in the name of the shortcut.  Anyway of doing something in Powershell or VB?

https://docs.microsoft.com/en-us/windows/desktop/shell/appids

If any of the following strings, regardless of case, are included in the shortcut name, the program is not pinnable and is not displayed in the most frequently used list:

Documentation
Help
Install
More Info
Read me
Read First
Readme
Remove
Setup
Support
What's New
1
C++ 11 Fundamentals
LVL 12
C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

In the checkbox list below...

I need on ckecked  = true for Opened or Clicked

That it is assured that checkboxes No FIlter and Delivered are unchecked
And value =


<asp:CheckBoxList ID="rblMetrics" CssClass="icheck1" runat="server" AutoPostBack="False"
CellPadding="0" CellSpacing="0" Height="0px" RepeatColumns="2" RepeatDirection="Horizontal"
Width="200px">
    <asp:ListItem Class="icheck1" Selected="True" Value="0" Text="No Filter"></asp:ListItem>
    <asp:ListItem Class="icheck1" Selected="False" Value="1" Text="Delivered"></asp:ListItem>
    <asp:ListItem Class="icheck1" Selected="False" Value="2" Text="Opened"></asp:ListItem>
    <asp:ListItem Class="icheck1" Selected="False" Value="3" Text="Clicked"></asp:ListItem>
</asp:CheckBoxList>  

Open in new window

0
I am attempting to convert to c# two  methods in vb6 for grids. Below is the pasted vb6 methods and after my work beginning on it. We are using BindingSource for .NET grid binding, label_fields is a list in .NET, . I appreciate any help as I am really behind.

Private Sub grd_label_UnboundGetRelativeBookmark(StartLocation As Variant, ByVal OffSet As Long, NewLocation As Variant, ApproximatePosition As Long)
    
    Dim current_row As Long
    Dim grid_rows As Long

    ' DBGrid calls this routine each time it
    ' needs to position a row.

    ' StartLocation is a bookmark supplied by the grid to
    ' indicate which records the grid wants to positioning from.
    ' If StartLocation is NULL, then data is requested either
    ' from the first row or the last row.
    On Error Resume Next
    grid_rows = UBound(label_fields)
    If Err = 0 Then
        If IsNull(StartLocation) Then
            If OffSet < 0 Then
                current_row = OffSet + grid_rows            ' Reading data from the last row
            Else
                current_row = OffSet - 1                    ' Reading data from the first row
            End If
        Else
            ' Positioning from StartLocation plus the OffSet
            current_row = Val(StartLocation) + OffSet
        End If
        If current_row < 0 Or current_row >= (grid_rows) Then
            NewLocation = Null
        Else
            NewLocation = current_row
            ApproximatePosition = current_row + 1  ' One

Open in new window

0
Hello,

I am running into quite an unusual problem and was wondering if anyone has experienced this issue before. I have an ActiveX Control that I have made that uses a Picture Box and displays an image from Azure blob storage by converting that image's memory stream into an image. I use this ActiveX Control for a Microsoft Access 2002 application. This ActiveX Control works great on forms, but on reports it doesn't display fully (Please see attached images). Anyone know why?
ActiveXFullyDisplayed.PNG
ActiveXNotFullyDisplayed.PNG
0
I Have this JSON
[{"uuid":"ead6b1c6-700c-446b-a96d-4809a00ba119","name":"BECCOFINO","created_at":"2017-05-08 09:26:07","updated_at":"2018-09-18 15:35:10","deleted_at":null,"levels":{"level2":[{"type":"F&B","uuid":"d7dc52f6-8b94-4ae2-9d7e-9e72b1f03853","name":"Beccofino","created_at":"2018-09-18 15:33:58",      "updated_at":"2018-09-18 15:42:21","deleted_at":"2018-09-18 15:42:21","customer_uuid":"ead6b1c6-700c-446b-a96d-4809a00ba119"},{"type":"Con_tact","uuid":"f7c4c881-88cb-433c-9bd7-9057fe8239d3","name":"Andrea Rotolli","created_at":"2018-09-18 15:38:08","updated_at":"2018-09-18 15:42:08","deleted_at":"2018-09-18 15:42:08","surname":"Rotolli","forename":"Andrea",      "prop_Gender":"Male","prop_Seize":"UXXXL","customer_uuid":"ead6b1c6-700c-446b-a96d-4809a00ba119"}]},"categories":["Auto Return","Available in Track"],"sync":"customer"}]

with these classes
    Public Class cls_JSON_Levels_Header_New
        Public uuid As String
        Public name As String
        Public created_at As String
        Public updated_at As String
        Public deleted_at As String
        Public levels() As cls_JSON_Levels_Body
        Public categories() As String
        Public sync As String
    End Class

    Public Class cls_JSON_Levels_Body
        Public level2() As cls_JSON_Level_Details
        Public level3() As cls_JSON_Level_Details
    End Class

    Public Class cls_JSON_Level_Details
        Public type As String
        Public uuid As String
        Public name As …
0
Hello,

I've database objects (like stored procedure, functions, views). I want to check which application is using respective object in source code.
FYI, source code are multiple location like SVN and VSTS & multiple projects with separate solution files.
So, I need to write a PowerShell script

1. To fetch db objects list from database' table
2. Iterate in both source repositories
3. In case find db object in source repository, add db object, repository URL and project name in new table in database.
4. In case not find, then add db object name in new table (as per 3rd point) with URL and project name blank

Best Regards
0
I tried jsp custom tag example.

custom tag color is not changing even though i changed to blue or some other color it still shows default color as attached.

Index.jsp is

<%--
    Document   : index
    Created on : Nov 6, 2018, 1:41:41 PM
    Author     : saiganesh
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="mytags" uri="/WEB-INF/tlds/my_tags" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <mytags:formattag colour="blue" font_size="50" is_uppercase="false">
            this is ext hello custom tag
            </mytags:formattag>
    </body>
</html>



my_tags.tld is

<?xml version="1.0" encoding="UTF-8"?>
<taglib version="2.1" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd">
  <tlib-version>1.0</tlib-version>
  <short-name>my_tags</short-name>
  <uri>/WEB-INF/tlds/my_tags</uri>
 
  <tag>
      <name>formattag</name>
      <tag-class>tags.FormatTag</tag-class>
      <body-content>scriptless</body-content>
      <attribute>
          <name>colour </name>
          <required>true</required>
      </attribute>
        <attribute>
          <name>font_size </name>
          <required>true</required>
      …
0

.NET Programming

133K

Solutions

39K

Contributors

The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.