Tag archive for ‘c’

use TSQL to assign value to a variable

Question:
Hi,  Expert
My database is using SQL server 2008; and I am using C#
I would like to select something from a table and then assign to a either string or integer varialbe
My plan is only select 2 values(rows) from a column . So I use “select top 2 [column_A] from table_X
how can I assign the return [...]

select or access element in datatable

Question:
Hi, experts
After I use dataadapter to get data from DB, and fill it in to datatable like below
SqlDataAdapter DA_subject = new SqlDataAdapter(str_subject_info, str_conn_sql);
DataTable DT_subject = new DataTable();
DA_subject.Fill(DT_subject);
Can I use SQL statement in Datatable? or how can I assess the element of the datatable. for example assign an element in datatable to a variable.
Could you please [...]

Runtime error in c++ program (include the code ) can any body help?

Question:
hello,
i want to fix this code to be run  perfect with out error.
Code Snippet:
2. include <iostream>
3. include <string>
4. include<fstream>
include<stdlib.h>
using namespace std;
/* Enumeration type that allows for different colors of wines */
enum WINE_COLOR
{
Red ,
White
};
/* Enumeration type that allows for different kinds of wines */
enum WINE_TYPE
{
Merlot ,
Chardonnay ,
Muscat ,
Shiraz ,
Port
};
/* array of Strings so I can print [...]

C# Threading Issue

Question:
Hi, Basically, I’m trying to experiment asynchronous method invocations from a console application. Please review the attached code.
There are two classes (TestCls & CreateFilesCls).  In TestCls I’m invoking an instance method “CreateFiles” of the class CreateFilesCls  thru an instance of delegate “DelegateCreateFile” using ThreadUtil’s FireAndForget method.
Here is ThreadUtil class code
http://www.eggheadcafe.com/articles/20060727.asp
Problem: The files are not always [...]

Exchange Web Services Managed API Error: Expected XML node type was XmlDeclaration, but actual type is Element

Question:
I have a simple test app to verify some functionality in Exchange Web Services Managed API. When Executing the code below I receive the error:
“Expected XML node type was XmlDeclaration, but actual type is Element”
I think I may have a permissions problem or some other issue but I have no idea where to look and [...]

Making all relative paths absolute in a HTML document

Question:
Hi,
I would like to know, if there’s a tool/class/script/anything, what would check all the relative paths in a HTML document and make them absolut.
Example:
URL: http://www.someurl.com/
in a HTML document I’ve got many tags, that could possibly identify it’s content source (or they link to) by a relative path, like eg. <img src=”./images/image.jpg” />, <link href=”/style/style.css” />. [...]

How To Parse A URL into sections in ASP.NET Using Pattern Matching

Question:
I am trying to find a way to parse a URL in the Global.asax file in ASP.NET into sections.
Given the example of: http://www.site.com/OptionalFirstURLSection/Pages/PageKey I need to find a way to capture the PageKey (maybe using a regular expression) in these scenarios:
The folder Pages exists in the URL string followed by some value –
PageKey from the [...]

Generate a upper case random guid string

Question:
below is a method for generate random string based on input length. just that the character in the random string has to be uppercase when return.
Code Snippet:
public static string GetRandomStringUsingGUID(int length)
{
// Get the GUID
string guidResult = System.Guid.NewGuid().ToString();
// Remove the hyphens
guidResult = guidResult.Replace(“-”, String.Empty);
// Make sure length is valid
if (((length <= 0)
|| (length > guidResult.Length)))
{
throw new [...]

problem related with float point issue (Converting Binary to Decimal with real part)

Question:
Hello expert,
i am trying to covert, binary to decimal (both int part and real part)
but it is not working as per my expectation, due to some floating point issues.
actually when i try some calculation of float, it is approximated. and this is causing trouble.
please check, i have attached code(.Cpp file) , sample output and comments [...]

Arrays programs in C/C++

Question:
Hello experts,
i am practising arrays programming in C/C++.
Can you please suggest me some problems / programs.
i am already done with finding min, max element, removing duplicate items from array,  sorting, searching, merging 2 arrays,
with 2-d arrays transpose, determinant, sum of diagnoal elements, sum of each row etc.
now i wish to do more practice.
please suggest me [...]