C# is an object-oriented programming language created in conjunction with Microsoft’s .NET framework. Compilation is usually done into the Microsoft Intermediate Language (MSIL), which is then JIT-compiled to native code (and cached) during execution in the Common Language Runtime (CLR).

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

Sign up to Post

OK so we have an in house marketing database that used to connect to a remote MySQL database on a Linux server. I decided to migrate to a MySQL server on our in house computer that also serves as the domain controller. everything is working fine except when I try to export a CVS. This was all operational when it was connecting to the Linux server prior. Please give me a hand guys!

The error that I am getting is below:
MySql.Data.MySqlClient.MySqlException (0x80004005): Fatal error encountered during command execution. ---> MySql.Data.MySqlClient.MySqlException (0x80004005): Fatal error encountered attempting to read the resultset. ---> MySql.Data.MySqlClient.MySqlException (0x80004005): Reading from the stream has failed. ---> System.IO.IOException: Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
   at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
   at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
   --- End of inner exception stack trace ---
   at …
Trouble with workflows that don't want to terminate.  I have workflows using the 2013 template that show completed, but still are in the running list.  I've looked at PowerShell and a C# console application to terminate them.

I haven't found a C# snippet that works nor a PowerShell snippet.

I also need this functionality for 2010 template workflows.

Any advice on all this would be appreciated.
I am trying to connect to a MongoDB database with asp.net core in C# with a userid and password.  Can anyone assist me in that respect?
I am trying to install a .NET 2008 application with click once and I am receiving the below error.  Any ideas?

The following properties have been set:
Property: [AdminUser] = true {boolean}
Property: [ProcessorArchitecture] = AMD64 {string}
Property: [VersionNT] = 6.1.1 {version}
Running checks for package 'Windows Installer 3.1', phase BuildList
The following properties have been set for package 'Windows Installer 3.1':
Running checks for command 'WindowsInstaller3_1\WindowsInstaller-KB893803-v2-x86.exe'
Result of running operator 'VersionGreaterThanOrEqualTo' on property 'VersionMsi' and value '3.1': true
Result of checks for command 'WindowsInstaller3_1\WindowsInstaller-KB893803-v2-x86.exe' is 'Bypass'
'Windows Installer 3.1' RunCheck result: No Install Needed
Running checks for package '.NET Framework 3.5', phase BuildList
Reading value 'Install' of registry key 'HKLM\Software\Microsoft\NET Framework Setup\NDP\v3.5\1033'
Read integer value 1
Setting value '1 {int}' for property 'DotNet35InstallSuccess'
The following properties have been set for package '.NET Framework 3.5':
Property: [DotNet35InstallSuccess] = 1 {int}
Running checks for command 'DotNetFX35\dotNetFx35setup.exe'
Result of running operator 'ValueEqualTo' on property 'DotNet35InstallSuccess' and value '1': true
Result of checks for command 'DotNetFX35\dotNetFx35setup.exe' is 'Bypass'
'.NET Framework 3.5' RunCheck result: No Install Needed
Running checks for package 'Crystal Reports …
In C#, How can i closehandle after duplicatehandle (closesource). I can't completely kill the mutex. Thank you.
How do I convert these properties and such from vb6 to vb.net or c# prefably. Thank you.

Public Property Let Confirmed(Index As Integer, bConfirmed As Boolean)
    If bConfirmed Then
        sTransferOrder_Items(Index, GI_CONF_TO_ITEM_CONFIRMED) = vbChecked
        sTransferOrder_Items(Index, GI_CONF_TO_ITEM_CONFIRMED) = vbUnchecked
    End If
End Property
Public Property Get Confirmed(Index As Integer) As Boolean
    Confirmed = (sTransferOrder_Items(Index, GI_CONF_TO_ITEM_CONFIRMED) = vbChecked)
End Property
I excluded a c# module ( under control of Team Foundation Server) in my visual studio solution. Prior to right clicking on source and excluding it - the status showed source module checked out.
I re-included it and the status shows not checked out.

How do I reestablish checked out without replacing it from server.

I have a folder with a bunch of files that come in a set of 2 files (e.g., Name.pdf, NameMD.pdf).  I need to loop through this source folder (call it FOLDER1) and move only each set of files to another folder (call it FOLDER2).   (NOTE: Then, I have another process that compares the contents of each set of PDF files.)

I need to search for a file that has a *MD at the end of the filename, then search for the 2nd file that does NOT have 'MD' at the end of the filename, then move both files to FOLDER2.  Then I have another process that processes files in FOLDER2.  Then repeat the loop in FOLDER1.

What is the code to do this as a vb script, a standalone console C#.Net or C#.Net inside of SSIS?




Here is my splash screen Activity

[Activity(Label = "MyActivity", Icon = "@drawable/AppLogo", Theme = "@style/SplashTheme",
           MainLauncher = false,ScreenOrientation =ScreenOrientation.Portrait, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
    public class splashScreen : Activity
        protected override void OnCreate(Bundle saveInstanceState)
            var mainActivityIntent = new Intent(this, typeof(MainActivity));


Open in new window

Hockey app unable to send the crash report for this issue Here is the code for hockey app crash report,inside the MainActivity.

protected override void OnResume()
            CrashManager.Register(this, "bfb3fc329eghsd21151d475886dd25058ef3f");

Open in new window

This happens on few devices including Redmi Note 5 Pro.  How to solve this issue?
I am trying to do one simple thing in C# and WPF (coming from WinForms, where this is very simple thing to do there, but WPF is a new world to me).

And that is, how to generate two buttons during runtime, and then on MouseDown on any of the buttons, make that button follow MousePointer. And on MouseUp, leave that button in new location.

In bottom example I was testing with labels, but I would like button or image at the end.
When I place Label/button manually everything works, Labels are created and I can move them on MouseDown/MouseMove, and leave them in new location:

   <Label Content="Label"
      Canvas.Left="{Binding XPosition}"
      Canvas.Top="{Binding YPosition}"

Open in new window

C# Code Behind:

 public partial class frmTables : Window, INotifyPropertyChanged
        private Point BasePoint = new Point(0.0, 0.0);
        private double DeltaX = 0.0;
        private double DeltaY = 0.0;
        private bool moving = false;
        private Point PositionInLabel;

        public frmTables()
            this.DataContext = this;

 public double XPosition
            get { return BasePoint.X + DeltaX; }

        public double YPosition
            get { return BasePoint.Y + DeltaY; }

Open in new window

Hello Folks,
I'm still wrapping this around my head..., I'm writing some code as follow:

$VariableA = "computerA"
once the content is verified OK, a bool variable will set to $True.

$variableA will always change, so what  I want is $variableA content into a new variable w/o depending on the user, to be utilized for further commands..., as opposed using current content I want the one prior

Does anybody have any ideas on how go by?
thanks for looking! :)
Using C# with a SOAP response and the Vertex Tax service, how do I collect the response of the EffectiveRate which is inside an array.

Using the Vertex Integrating O Series 6.0 with .NET

This works for the TaxValue that is outside of the LineItem . . .

VertexEnvelope ve = new VertexEnvelope();
calculateTaxResponse cTR = new calculateTaxResponse(ve);

strTAX_RATE = ((TaxCodeCollector.CalculateTaxService.InvoiceResponseType)ve.Item).TotalTax.Value.ToString();

Open in new window

I have two copies of a web application has been written in ASP.net C#. One application is online and the other one is off-line, I need to have the same data(SQL database with more than 20 tables)  in the online one to be transferred to the off-line  one programmatically. I will have a backup data from the online one on a USB and then I need to have a button in the offline application to restore these data. how could I do such a thing?
 please help &  thanks in advance.
i have a gridview with an approve button in a template field and a button called show pending records.

this is the button the user clicks


this is my gridview code

<asp:GridView ID="GridView1" CssClass="GridViewMasterSettings" runat="server" CellPadding="3" AutoGenerateColumns="False" ShowHeaderWhenEmpty="True" DataKeyNames="GeneralID" ViewStateMode="Enabled" AllowPaging="True" OnRowEditing="GridView1_RowEditing" OnRowCancelingEdit="GridView1_RowCancelingEdit" OnRowDeleting="GridView1_RowDeleting" PageSize="20" OnPageIndexChanging="GridView1_PageIndexChanging" OnRowDataBound="GridView1_RowDataBound" AllowSorting="True" OnSelectedIndexChanged="GridView1_SelectedIndexChanged">
     <FooterStyle BackColor="#fbe6b9" ForeColor="#000066" Wrap="True" />
     <HeaderStyle CssClass="GridViewMasterSettingsth" />
     <PagerStyle BackColor="#fbe6b9" ForeColor="#000066" HorizontalAlign="Left" />
     <RowStyle CssClass="GridViewMasterSettingsRow" />
     <AlternatingRowStyle CssClass="GridViewMasterSettingsRowAlternatingRow" />
     <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
     <SortedAscendingCellStyle BackColor="#F1F1F1" />
     <SortedAscendingHeaderStyle BackColor="#007DBB" />
     <SortedDescendingCellStyle BackColor="#CAC9C9" />
     <SortedDescendingHeaderStyle BackColor="#00547E" />

<asp:TemplateField HeaderText="Production" 

Open in new window

Hi Experts,

How to scan for viruses while uploading file like image,doc etc .  I am using c# and MVC.
Any help is greatly appreciated.

Thanks in advance!
I am trying to check my sim card balance with using USSD commands with C#.
But the problem is I am getting only an "OK" in response, instead of the balance msg someting like "Your current balance is.....".
But whenever i'm running my code, the default application of my modem is getting the balance message.

string response = gsmPort.ReadExisting(); //it is getting "OK\r\n" only.

Open in new window

After converting my .NET website from VS 2015 on the server to a .NET Application in VS 2017 on my client, it seems that the events are no longer "wired up." AutEventWireup="true".

We have tried deleting the designer and rebuilding it.

None of the control events are working as before.

How can I fix this?
Cannot send a content-body with this verb-type error in statement:
Regel 25:             using (Stream stream = requestObjGet.GetRequestStream())

I have a non-generic way of filling a grid with non-related items.

So, for example I have an entity called Stock and an entity called CustomerTypes

They are both IRepositories.

I have a third entity called StockPrice

This table is very simple – it has a StockId, CustomerTypeId, IsPrimary and StockPrice, Stockname, customertypename

The concept is based off the devexpress project available on github here:

In other words it is ripped and modified from there (The WinForms project)

I have attached a word document showing my code. I'm attempting to make something non-generic to generic but need a helping hand.question.docx
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.
This code currently works but I would like to add some columns to the result set. Once such column is the ContentType of the document in the path column.

Here is the code I am using and it does indeed return a datatable with results but it has ContentTypeID (Some Unique Identifier).

SharePointSearchAPI.QueryService queryService = new SharePointSearchAPI.QueryService(); queryService.Url = SharePointServiceURL;

            queryService.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;

            // set search string
            StringBuilder xmlString = new StringBuilder("<QueryPacket xmlns='urn:Microsoft.Search.Query'>" +
                            "<Query><SupportedFormats><Format revision='1'> urn:Microsoft.Search.Response.Document:Document" +
                            "</Format></SupportedFormats><Context><QueryText language='en-US' type='STRING'>");
            xmlString.Append(SharePointSearchString); // user entered text
            System.Data.DataSet queryResults = queryService.QueryEx(xmlString.ToString());
DataTable dtResults = queryResults.Tables[0];

how can I reduce video size? When I save a video 10sec video have 100MB. How can I set bitrate for recording?

Thank you

using System;
using System.Drawing;
using System.Windows.Forms;
using AForge.Video;
using AForge.Video.DirectShow;
using AForge.Video.VFW;

namespace Aforge_Web_Cam
public partial class VideoForm : Form
private FilterInfoCollection VideoCaptureDevices;
private VideoCaptureDevice FinalVideo = null;
private VideoCaptureDeviceForm captureDevice;
private Bitmap video;
private AVIWriter AVIwriter = new AVIWriter();
private SaveFileDialog saveAvi;

public VideoForm()

private void VideoForm_Load(object sender, EventArgs e)
VideoCaptureDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
captureDevice = new VideoCaptureDeviceForm();

private void butStart_Click(object sender, EventArgs e)
if (captureDevice.ShowDialog(this) == DialogResult.OK)
VideoCaptureDevice videoSource = captureDevice.VideoDevice;
FinalVideo = captureDevice.VideoDevice;
FinalVideo.NewFrame += new NewFrameEventHandler(FinalVideo_NewFrame);

void FinalVideo_NewFrame(object sender, NewFrameEventArgs eventArgs)
if (butStop.Text == "Stop Record")
video = (Bitmap)eventArgs.Frame.Clone();
pbVideo.Image = (Bitmap)eventArgs.Frame.Clone();
AVIwriter.Quality = 0;
video = (Bitmap)eventArgs.Frame.Clone();
pbVideo.Image = (Bitmap)eventArgs.Frame.Clone();


Open in new window

Hi, I have a blog website build using ASP.NET using C# and entity framework.
I have this requirement where I need to list all my published blogs and paginate them as they are too many.
I am new to .NET and have no idea how to do it.

Earlier I got all the blog details from the database and used ajax and JSON as well to fetch it.

A friend gave me a sample code and told me it would help. Please have a look into that as well.

Please help me acheive this.
I am attaching all my code here along with the stored procedure.


/****** Object:  StoredProcedure [dbo].[GetBlogs]    Script Date: 05-11-2018 01:50:14 AM ******/
ALTER proc [dbo].[GetBlogs]

@count int,
@start int,
@categoryId int,
@blogCount int Output
	Declare @LastBlog int
	Set @count = 9
	Set @lastBlog = @count + @start;

	create table #x (id int identity(1,1),blogid int)

	if @categoryId is null
			insert into #x
			select Id from Blog where IsDeleted=0 and StatusId = 2

			insert into #x	
			select b.Id from Blog b inner join BlogCategories bc on b.Id = bc.BlogId where bc.CategoryId = @categoryId and b.IsDeleted=0 and b.StatusId = 2;
	select @blogCount = COUNT(#x.id) from #x 

	select b.* from #x inner join Blog b on #x.blogid = b.Id where #x.id > @start and #x.id <= @LastBlog

	drop table #x


Open in new window

DAL Sample Code

using System;

Open in new window

I can access the oracle tables and stored procedures using C#, but i am getting error when trying to use select oracle VIEW.
Below code i am using. I have access to that view also.
I don't even understand what mistake i did, please do the needful, very urgent.
If you have any piece of code to connect oracle view, please post it.

Error:Operation is not valid due to the current state of the object."

OracleConnection con = null;
OracleCommand cmd = new OracleCommand();
OracleDataReader dr = null;

    con = new OracleConnection("COnstring");
    string strQuery = string.Empty;

    strQuery = "select col1,col2 from VW_test_view where col1 ='" + COL1 + "'";
    cmd.CommandText = strQuery;
    cmd.CommandType = CommandType.Text;
    dr =cmd.ExecuteReader(); 

    if (dr.HasRows)
        while (dr.Read())
            statusCode = dr["col2"].ToString();

Open in new window

Whats is the best too for Web services Testing Tool?
REST and API Testing
I'm planing to by Smart bear.Any idea is appreciated.
Company happy to pay for that.






C# is an object-oriented programming language created in conjunction with Microsoft’s .NET framework. Compilation is usually done into the Microsoft Intermediate Language (MSIL), which is then JIT-compiled to native code (and cached) during execution in the Common Language Runtime (CLR).