.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
MarieAdela
Imran Ghani
Post New Web Links

Need some help converting some MDX code

Posted By:      Posted Date: October 13, 2010    Points: 0   Category :Sql Server
 

I wrote this snippet a few years ago for a sales ranking program.  It takes a Month/Year parameter and returns results over a period controlled by another parameter. 

SET

 

[Gr Profit] as ORDER(NONEMPTY([Customers].[Customer Name Account].[Customer Name Account].members,({[Measures].[Gross Profit]},lastperiods(@RollBackNum,


View Complete Post


More Related Resource Links

Converting C# code to T-SQL

  

Hi I have this code in c# and I want to convert this to T-SQL and put in stored proc. I'm having a problem in speed as I am processing more than 50000 records at a time and the Update statement slows it down. I was thinking stored procedure could help on my problem. Thanks in advance.

Here's what I have:

sqlStmt = "SELECT DISTINCT(phone_no) FROM TEMPTABLE WHERE sUSER='" + USERName + "' ORDER BY phone_no";
            sqlConn.Open();
            SqlCommand cmd = new SqlCommand(sqlStmt, sqlConn);
            SqlDataReader dr = cmd.ExecuteReader();
        

java code converting to asp.net

  

i have java code whch is used to get data from oracle

i want to implement it in asp.net  java code is

OracleResultSet cursor=null;      
          OracleCallableStatement cstmt = (OracleCallableStatement)con.prepareCall("DECLARE inSQL SYS_REFCURSOR; BEGIN open inSQL for select NULL,NULL,NULL, NULL,NULL, '"+m.replaceAll("'","''")+"','',NULL,NULL,NULL,NULL,'"+op.replaceAll("'","''")+"','"+a.replaceAll("'","''")+"','','"+city.replaceAll("'","''")+"','"+state.replaceAll("'","''")+"','"+province.replaceAll("'","''")+"','"+postalCode.replaceAll("'","''")+"','"+country.replaceAll("'","''")+"','"+GDWSource+"','','','','','' FROM dual; ? := frdw.c_ss_cleaning_pkg.call_interactive_Search('"+s+"', '',"+resultsRows+" ,inSQL, ?, ?, ?, ?); end;"); 
          
              
          cstmt.registerOutParameter(1, OracleTypes.INTEGE

Need help converting code

  

Greetings experts,

I know I am going backwards but please forgive me and assist if you can.

I have the following asp.net code that I would need your help converting to classic asp.

I am going backwards because I alread have a huge classic asp app and this bit is the new requirement that I am having problem with.

I need to convert base64 to image.

I found the code but unfortunately (for me), it is in .net.

Here it is and thanks a lot in advance for your assistance.

 

//c# version

public Image Base64ToImage(string base64String)
{
  // Convert Base64 String to byte[]
  byte[] imageBytes = Convert.FromBase64String(base64String);
  MemoryStream ms = new MemoryStream(imageBytes, 0,
    imageBytes.Length);

  // Convert byte[] to Image
  ms.Write(imageBytes, 0, imageBytes.Length);
  Image image = Image.FromStream(ms, true);
  return image;
}

'vb version

Public Function Base64ToImage(base64String As String) As Image
	' Convert Base64 String to byte[]
	Dim imageBytes As Byte() = Convert.FromBase64String(base64String)
	Dim ms As New MemoryStream(imageBytes, 0, imageBytes.Length)

	' Convert byte[] to Image
	ms.W

Converting Java Code to C#

  

I have about 60 lines of Java code I need to convert to C#. This code creates a UDP packet and sends it to a destination IP address on port 1761. I'm not sure what the equivalent C# code is to manipulate the java byte data type and not sure what the Datagram equivalent is.

This is the Java code I need to translate to C#

	private void jBtnReadActionPerformed(ActionEvent e)
	{
		byte buf[] = new byte[512];
		int i = 0;

		//1. Check the Buttons to verify that only UDP-API command button is selected
		if (true == jRBtnUdpCmd.isSelected())
		{
			Integer i1 = Integer.valueOf(jTxtCmdId.getText());
			int tmp = i1.intValue();
			buf[i++] = (byte)((tmp >> 8) & 0xFF);
			buf[i++] = (byte)(tmp & 0xFF);

			// set Byte 2:0x00 (read request) and byte three: 0x00 (reserved)
			buf[i++] = READ_REQUEST;		// READ_REQUEST is set to 0x00
			buf[i++] = 1;			// This byte is reserved.
//			buf[i++] = RESERVED;			// This byte is reserved.

			// convert the space delimited ASCII hex data to byte value
			String strData = jTxtCmdData.getText();
			int strDataLen = strData.length();

//System.out.println("String: " + strData + "    Len: " + strDataLen);

			byte[] newBuf = new byte[strDataLen];
			int len = convertAsciiHexToByte(strData, strDataLen, newBuf);

			// insert 4 bytes of header and copy the remaining byte

Code Optimized Web Development Profile (VS 2010 and .NET 4.0 Series)

  
When you first run VS 2010 it prompts you to select an IDE profile to use. The profile you select will configure how tool windows are displayed/docked in the IDE by default and set the default keyboard shortcuts. You can then customize any of these settings by using the Tools->Options menu within the IDE and then override/change them. You can also later reset your profile and pick a different one by choosing the Tools->Import and Export Settings menu command.

Free Code Snippets - ASP.NET

  
You Can Find Useful ASP.NET Related Posts on the above link.

Free Code Snippets - C#

  
Free C# Code Snippets

call JavaScript - jQuery code from ASP.NET Server-Side

  
jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side.

call JavaScript - jQuery code from ASP.NET Server-Side

  
jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side

Microsoft StyleCop: Source Code Analyzer for C#

  
StyleCop is similar in many ways to Microsoft Code Analysis (specifically FxCop), but there are some important distinctions. FxCop performs its analysis on compiled binaries, while StyleCop analyzes the source code directly. For this reason, FxCop focuses more on the design of the code, while StyleCop focuses on layout, readability and documentation. Most of that information is stripped away during the compilation process, and thus cannot be analyzed by FxCop.

Code spelling checker extension for visual studio 2010

  
Building a spelling checker for source code as an extension for visual studio 2010.

C# and XML Source Code Documentation

  
Through many years of enterprise level software development and consulting, I became critically aware of the importance of good source code documentation, and several years ago when I began working with the first release of Visual Studio .NET beta 1 and found C# provided built-in support for inline XML code documentation, I was thrilled.

Bar Code Scanners with the .NET Compact Framework

  
Summary: Learn how to make your applications use bar code scanners in a generic way-ndependent of the specific bar code scanners that are used on different devices. Using the design patterns Façade and Factory, the implementation not only supports multiple bar code scanners, but it also makes it easy to add support for other bar code scanners. After a brief discussion about bar code scanners and the bar code scanner pattern, a download code sample, written in C#, demonstrates the use of the pattern and technologies.

PrinterCE for .NetCF - Code Samples

  
1)Example:Hello World
2)Example:Form Test
3)Example:DrawTextFlow
4)Example:TextColumns
5)Example: Bar Code Test
6)Example:Text Wheel
7)Example:Image Rotation
8)Example:Line Fun

.net code converter

  
For coverting your programming langugae to another languge the below site is very help full

http://www.developerfusion.com/tools/convert/vb-to-csharp/

Code works on aspx but not ascx

  

Not sure which category to put this question in, so I will put it in here.

Just to give you an idea of the layout of my solution, I have the main project, along with 2 class libraries, BLL and DAL.  (Business Logic Layer and Data Access Layer)

The BLL refers to the DAL and the main project refers to the BLL.


I had a test website and the code worked fine, but the same code will not work on the real project. The only difference is that in the test project, the code was on an aspx code behind, whereas in the real project, it is an ascx code behind (Web User Control )

The code is:

Dim connectionString As String = ConfigurationManager.ConnectionStrings("ASPNETDBConnectionString").ConnectionString
        Dim recordEntry As New UserRecord(connectionString)
        recordEntry.UserName = "TestName"
        recordEntry.BMI = bMI
        recordEntry.BMR = bMR
        recordEntry.FTM = fTM
        recordEntry.TDEE = tDEE
        recordEntry.TodayDate = dateForToday
        recordEntry.InsertRecord()



Dim connectionString As String = ConfigurationManager.ConnectionStrings("ASPNETDBConnectionString").ConnectionString

how to set break point at inline code

  
I set the element height value by using inline code 
<%# Eval("s") %>
where "s" is the variable declared in page load event. when i run the application it don't set the height. 
Is there any way, i can set break point into .aspx file. i mean how i can check if my Eval("s") get the value.  
<
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend