Showing posts with label net. Show all posts
Showing posts with label net. Show all posts

Sunday, March 25, 2012

(newbie) Cant connect to msde Database,

Hi,
I am an ASP.net newbie learning thru databasing now.
When setting up and connectiong to Database, i am prompted at SQL Server
Authentication for a user name and password
When I installed, thru the CMD under Start: Run in Windows 2000, i believe i
specified "sa" and "password" for user name and password. but now i get an
error, trying to input that.
"unable to connect to database.
Login failed for user "sa" Reason : not associated with a trusted SQL Server
connection"

What am i doing wrong? if i mistyped the password info when setting up,
where can i check it? or reset it?

Please someone help me

RaphaelSo are you using a ASP.Net script to connect to the DB?

The SQL connection should look like:

server=localhost;Trusted_Connection=true;database=theDB;user id=sa;password=password

Does that make sense to you?

Adrian|||um,

No not at first site, I am a newbie, remember!
I am trying to run from the web matrix project, and i simply cannot create a new msde database.

Do you have any further advice?

Thanks

Raphael

Monday, March 19, 2012

"SQL Server Mobile encountered problems when opening the database."

Hi,

I am writing an application for a device (HP IPAQ 6828) having Windows Mobile 5.0 using

-MS .NET Compact Framework 2.0 SP-1
-SQL Mobile 2005.
-VS 2005 .NET

The application uses Merge Replication. The error occurs in the Synchronise() Method of the SqlCeReplication object.

"SQL Server Mobile encountered problems when opening the database."

repl.AddSubscription(AddOption.ExistingDatabase)
repl.Synchronize()

I also checked the the connection string and it seems to be fine. Both my device and server can ping each other. Moreever I can also access the Web syncronization folder(on server) from the device.

Is anyone having a resolution for this?


This problem may be caused by many reasons.

The most common is not disposing the replication object or other data related objects. Make sure there isn't any other arround.
Sql Mobile 2005 allows multiple connections except while syncronizing.

Another known cause is a bad path on the connection string.

Other forum entries referring this problem:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=334604&SiteID=1

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=478902&SiteID=1

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=961633&SiteID=1|||

Hi,

I finally found the solution to this...

repl.AddSubscription(AddOption.ExistingDatabase)
repl.Synchronize()

(Note: I am trying to synchronize on an exisiting database)

The problem was since my database is already in use by my application and I am trying to sync the same DB. Synchronization cannot occur if the connection is already open by the application. Sql Mobile 2005 allows multiple connections except while synchronizing.

Therefore we need to close and dispose the open connection used by the application as under before attempting to synchonize.

(Below is the sample code)

private sub SampleSync()

sharedCon.close
sharedCon.dispose

try

' TO DO: Set replication object properties here

repl.AddSubscription(AddOption.ExistingDatabase)
repl.Synchronize()

finally
repl.dispose
end try

' TO DO: Open your shared connection here if required.

End sub

Note: Most of the times the connection string also causes a problem. A sample connection string would look like this...

repl.SubscriberConnectionString ="\Program Files\YourAppName\YourDb.sdf;Password =<...>"

Thursday, March 8, 2012

"Keyword not supported: 'provider'." error with Report Builder

Hi,

I'm trying to process reports with Report Builder against a SQL Server Database.

When the .Net Provider is used in the model, everything works fine.

But if I try to use another provider (the .Net Provider for OLEDB or the native OLEDB one) to connect to the data source, i've got the following error when trying to process the report in Report Builder: Keyword not supported: 'provider'.

Is this a normal behaviour of the Report Builder ?

Thanks in advance.

Grgory.

I have tried OLE DB data sources (for Sybase) on SQL Server 2005 server, and it just doesn't work. Ended up using ODBC

The same steps worked fine on SQL Server 2000 (can access Sybase through OLE instead of ODBC)

I think it's not really a Report Server issue

Tuesday, March 6, 2012

"Encrypt" argument not supported in CF 2.0 Sqlconnection.ConnectionString

Is "Encrypt" not support in Compact Framework 2.0 SqlConnection string?

Trying to connect to sql2005 db using SSL from WM5/.net 2.0 pda and am receiving the below error. I can connect fine w/o the "encrypt" argument and the same connection string with "encrypt" connects fine from XP workstation to sql db w/SSL.

"Unknown connection option in connection string: encrypt."

Connection String I used:

sqlConnection = new SqlConnection("Data Source=mysqlserver;Initial Catalog=sometable;UID=username;PWD=Password;Encrypt=true;");

Thanks,

Jim

Hello everybody

I have the same problem. I'm using mobile PC with WinCE 4.2 on board. And I need the connection to be encrypted. How can I make this? The CF1.0/2.0 doesn't allow this feature. :(

Also I can use the VPN connection. But my device doesn't have this function (the function is present in disable mode). May be there is another application that realize VPN for WinCE 4.2?

Thank you.

Best regards,

Sergey

|||

This works in my code. I'm showing you the function that calls GetConnectionString so you'll see where the string is being passed.

Public Shared Function GetConnection(ByVal strDatabaseName As String) As SqlCeConnection

Dim cn As SqlCeConnection

cn = New SqlCeConnection(GetConnectionString(strDatabaseName))

Return cn

End Function

Public Shared Function GetConnectionString(ByVal strDatabaseName As String) As String

Return "Data Source=" & strDatabaseName & ";SSCE:Database Password=xxxxxxxx;SSCE:Encrypt Database=True"

End Function

|||

Why did you write the 'ssce' near connection string properties? Is it rule or something else?

Also, I need connect to the Sql Server on the host (not mobile sql server) and I use the SqlConnection class for it. Can I use such connection string? I didn't find the information in the msdn about its description.

Sorry, but I can't check your advise now and see the result, I'm away from my workstation. That is why I want to know more. And I'll check it latter.

|||

To Clearify - I'm trying to encrypt the sql connection to the host using, not to a local installation of SQL Mobile. I believe a couple of replies address encrypting data or the database of a local sql mobile db.

Jim

|||Sorry, I did not notice you were not using sqlce.|||This means that Encrypt is not supported in Compact Framework 2.0 SqlClient.SqlConnection|||

This code sample does not work on a WM 5 device with cf 2.0 but works ok if "Encrypt=true" is removed. Am I doing something wrong? Same code works fine on XP with .Net 2.0 when connecting to same ssl enabled sql server. How can I encrypt a sql connection from pda to sql server?

Thanks,

Jim

sqlConnection = new SqlConnection("Data Source=someSql2005Server;Initial Catalog=someSqlTable;"

+ "UID=myUsername;PWD=somePassword;Encrypt=true");

|||The compact framework is not the full .NET framework. Some features are disabled or just not implemented. If you get an error that the connection could not be established because of the encrypt feature not being available it's just not implemented!

"Duplicated parameter names are not allowed" exception in SQL Server Everywhere

I'm using SQL Server Everywhere CTP with ADO.NET and C# 2.0 and getting following exception:
"Duplicated parameter names are not allowed. [ Parameter name = @.NODE_ID ]"
for the query:

SELECT CHANGE_TYPE,CHANGED,VTRANS,LINK_PARTITION_ID,LINK_ID, SOURCE_PARTITION_ID,SOURCE_NODE_ID,TARGET_PARTITION_ID,TARGET_NODE_ID,TYPE,LOCAL_CHANGE_TIME,ATTR FROM VP8657b26964d4c595a7430761c222f3b3_REL WHERE (((TARGET_NODE_ID=@.NODE_ID AND REL_BASE_TYPE=2)) AND LOCAL_CHANGE_TIME > @.LOCAL_CHANGE_TIME ) OR ((SOURCE_NODE_ID=@.NODE_ID AND REL_BASE_TYPE=2)) ORDER BY LOCAL_CHANGE_TIME DESC

Without underlined frament, query runs fine

IDbCommand.Parameters shows that there are exactly 2 parameters with different names: @.LOCAL_CHANGE_TIME and @.NODE_ID

Exception stack trace is:
System.Data.SqlServerCe.dll!System.Data.SqlServerCe.SqlCeCommand.CompileQueryPlan() + 0xd5 bytes
System.Data.SqlServerCe.dll!System.Data.SqlServerCe.SqlCeCommand.ExecuteCommand(System.Data.CommandBehavior behavior = Default, string method = "ExecuteReader", System.Data.SqlServerCe.ResultSetOptions options = None) + 0x145 bytes
System.Data.SqlServerCe.dll!System.Data.SqlServerCe.SqlCeCommand.ExecuteReader(System.Data.CommandBehavior behavior = Default) + 0x2d bytes
System.Data.SqlServerCe.dll!System.Data.SqlServerCe.SqlCeCommand.ExecuteDbDataReader(System.Data.CommandBehavior behavior = Default) + 0x1e bytes
System.Data.dll!System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader() + 0xa bytes

So, what this exception might mean? does it mean that a parameter might not be used multiple times in a query?

alex777 wrote:

So, what this exception might mean? does it mean that a parameter might not be used multiple times in a query?

Unfortunately, that's precisely what it means. If you watch (with SQL Profiler, for example) how a query is run when you submit it with ADO, you'll see that it's fluffed and rumpled just a little bit -- in order to make parameters work. That fluff-and-rumple mechanism can't deal with the same parameter name being bound again.

You can rewrite your query to be a batch that assigns @.NODE_ID to a variable, then reference the variable in the query. Or, you can create @.NODE_ID1 and @.NODE_ID2, and spread those guys around in the query -- then bind the same variable in the client code to the two different values (that is, add two parameters, each with the same value as the other).

|||Thanks for your reply,

Is it an issue only with SQL Mobile (aka Everywhere) or this will also

be present in SQL Express and Full-Featured SQL Server or even in any

ADO.NET provider?

> You can rewrite your query to be a batch that assigns @.NODE_ID to a variable, then reference the variable in the query.

SQL Mobile seems not to support batch queries (maybe executing multiply commands within the same connection will work, but it's a pretty mess. )

Anyway, I'm going just to substitue this parameter manually:
com.CommandText = com.CommandText.Replace("@.NODE_ID", "'"+guid.ToString()+"'");

Saturday, February 25, 2012

"Could not find installable ISAM"

Hi, when l use the ADO.NET with the following query,
SELECT * INTO XLImport5 FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=C:\test\xltest.xls', 'SELECT * FROM [Customers$]')

i get the following error, i.e.

Error: 0xC002F210 at Execute SQL Task, Execute SQL Task: Executing the query "SELECT * INTO XLImport5 FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=C:\test\xltest.xls', 'SELECT * FROM [Customers$]')" failed with the following error: "Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)".
OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)" returned message "Could not find installable ISAM.".". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
Task failed: Execute SQL Task

Any idea, what's wrong?

Regards,
YB Lim


I read before... a fix for that could be to reinstall MDAC.

http://support.microsoft.com/default.aspx/kb/283881

http://support.microsoft.com/default.aspx/kb/209805

http://support.microsoft.com/default.aspx/kb/90111

"Class not registered" with RMO and x64 Windows

I have a small .net application that uses RMO to synchronize a merge subscription. Everything works fine when I build with platform target = "Any CPU" on both x86 and x64 systems, but I get a "Class not registered" error on my x64 system when the application is built with platform target = "x86". Incase you are wondering I have to run this code under x86 because it is actually going to distributed in a dll and called from an x86 application.

x64 System:

Microsoft Windows Server 2003 R2

Enterprise x64 Edition

Service Pack 1

Here is my code:

{
ServerConnection dbconn = new ServerConnection(publication_server);
dbconn.LoginSecure = true;
dbconn.Connect();

MergeSubscription subscription = new MergeSubscription();
subscription.ConnectionContext = dbconn;
subscription.DatabaseName = publication_db;
subscription.PublicationName = publication_name;
subscription.SubscriberName = subscription_server;
subscription.SubscriptionDBName = subscription_db;

if (!subscription.LoadProperties() || subscription.SubscriberSecurity == null)
throw new Exception("Unable to initialize the Synchronization");

MergeSynchronizationAgent agent = subscription.SynchronizationAgent;
agent.Synchronize();
}

The MergeSynchronizationAgent class is platform specific (it is just a thin wrapper around a pile of native code), so you would need to make sure that you have the x86 version of SQL Server installed on your x64 server if you compile your exe as x86.

-Raymond

|||

I would hate to install an x86 instance of SQL Server to solve this issue. Is there anything short of that I can do to get the appropriate files and registry keys on to an x64 system?

Thanks for your help.

|||

Sorry to disappoint you, but there really isn't a supported way to allow you to just pick the dependencies for running the MergeSynchronizationAgent class although we have plans to come up with a merge module for replication components in the future. Realistically, it would be rather difficult to just pick out the dependencies for the MergeSynchronizationAgent class as it depends on things that folks normally don't suspect such as:

sqlncli.dll\rll

msvc80*.dll

The 2.0 .NET Framework

instapi.dll under 90\Share and corresponding registry key for locating it.

-Raymond

Sunday, February 19, 2012

<undefined value>

Greetings,

I asked this question over on the ADO.NET newsgroup and couldn't scrape
up an answer. I realize that it is more of an ADO question than an SQL
Server question, but I'm hoping there might be an ADO programmer here
that can explain this to me.

I'm developing database applications using C# on VS.NET 2003 and SQL
Server Standard edition (SP3a).

I've run into a situation I'm trying to understand, to wit, if I submit
a query using SqlCommand.ExecuteScalar which returns no results, why is
the returned item a System.Object of <undefined value>?

(Actually, I think I know why -- ExecuteScalar returns a null reference
if there are no results.)

How do I do test for that condition?

I guess I can sort of see why they didn't want to throw an exception --
lot's of queries don't return any results, but on the other hand, I
can't figure out how to test for <undefined value>, either.

Any ideas?

-- Rick> How do I do test for that condition?

Object myScalarResult = myCommand.ExecuteScalar();
if ( myScalarResult == null )
{
// no result returned
}

--
Hope this helps.

Dan Guzman
SQL Server MVP

--------
SQL FAQ links (courtesy Neil Pike):

http://www.ntfaq.com/Articles/Index...epartmentID=800
http://www.sqlserverfaq.com
http://www.mssqlserver.com/faq
--------

"Guinness Mann" <GMann@.dublin.com> wrote in message
news:MPG.19edf588afa984d79896f5@.news.newsguy.com.. .
> Greetings,
> I asked this question over on the ADO.NET newsgroup and couldn't
scrape
> up an answer. I realize that it is more of an ADO question than an
SQL
> Server question, but I'm hoping there might be an ADO programmer here
> that can explain this to me.
> I'm developing database applications using C# on VS.NET 2003 and SQL
> Server Standard edition (SP3a).
> I've run into a situation I'm trying to understand, to wit, if I
submit
> a query using SqlCommand.ExecuteScalar which returns no results, why
is
> the returned item a System.Object of <undefined value>?
> (Actually, I think I know why -- ExecuteScalar returns a null
reference
> if there are no results.)
> How do I do test for that condition?
> I guess I can sort of see why they didn't want to throw an
exception --
> lot's of queries don't return any results, but on the other hand, I
> can't figure out how to test for <undefined value>, either.
> Any ideas?
> -- Rick|||In article <pV4hb.9598$mQ2.8310@.newsread1.news.atl.earthlink.n et>,
danguzman@.nospam-earthlink.net says...
> > How do I do test for that condition?
> Object myScalarResult = myCommand.ExecuteScalar();
> if ( myScalarResult == null )
> {
> // no result returned
> }

Sheesh. Simple enough once you know the answer, eh? Thanks!

Here's what I've been doing:

Object myScalarResult = myCommand.ExecuteScalar();
int returnValue = Convert.ToInt32(myScalarResult);

Which returns 0 if null, otherwise the Int32 I'm looking for.
Fortuitously, 0 is not in the possible solution set, so by coincidence,
it works.

Thanks again,

-- Rick

Thursday, February 16, 2012

<! comments > with SQLXML & ASP.NET

Hi,
I'm using a SqlXmlCommand object with XSL templates + ASP.NET. I
stream the output to a file for later use. However, HTML comments
from the XSL file are not present in the merged file. Is there a way
to keep them ?
Thanks
OK I found it. Using <xsl:comment>mycomment</xsl:comment> solved the problem.

> Hi,
> I'm using a SqlXmlCommand object with XSL templates + ASP.NET. I
> stream the output to a file for later use. However, HTML comments
> from the XSL file are not present in the merged file. Is there a way
> to keep them ?
> Thanks

>> Help with Stored Procedure

Hi, I'm so new to programming in MS SQL that the paint is still wet behind m
y
ears...
Using sql 2000 and vb.net (I normally develop in MS Access)
I have a search form set up so that users can enter any combination of the
following search criteria:
User types all or part business name,
User types all or part account name,
User selects from a ComboBox a business type
User types all or part contact name,
User selects from a ComboBox a contact type
I want to have a stored procedure that can handle any combinations of data
entry. The following is my guess for structure and it does not compile...
CREATE PROCEDURE GetSearchResult
@.Account nvarchar(10),
@.Business nvarchar(100),
@.BusinessTypeID Int,
@.ContactID Int,
@.Contact nvarchar(100),
@.ContactTypeID Int
DECLARE @.SearchOptions Int
DECLARE @.ErrorStatus Int OUTPUT
AS
IF LEN(@.Business)>0
SET @.SearchOptions = 1
IF LEN(@.Account) > 0
SET @.SearchOptions = @.SearchOptions + 2
IF @.BusinessTypeID > 0
SET @.SearchOptions = @.SearchOptions + 4
IF LEN(@.Contact) > 0
SET @.SearchOptions = 10
IF @.ContactTypeID > 0
SET @.SearchOptions = @.SearchOptions + 11
CASE @.SearchOptions
WHEN 1 THEN
-- Only search for Business name
BEGIN
SELECT * FROM vwBusinessSearchResult
WHERE bBusiness LIKE '%' + @.Business + '%'
END
WHEN 2 THEN
-- Only search for Account name
BEGIN
SELECT * FROM vwBusinessSearchResult
WHERE bAccount LIKE '%' + @.Account + '%'
END
WHEN 3 THEN
-- Search for Business name and Account
BEGIN
SELECT * FROM vwBusinessSearchResult
WHERE bBusiness LIKE '%' + @.Business + '%'
AND bAccount LIKE '%' + @.Account + '%'
END
WHEN 4 THEN
-- Only search for Business type id
BEGIN
SELECT * FROM vwBusinessSearchResult
WHERE bID Exists In(SELECT bbtBusinessID
FROM tblBusinessBusinessType
WHERE bbtBusinessTypeID = @.BusinessTypeID)
END
WHEN 5 THEN
-- Search for Business name and Business type id
BEGIN
SELECT * FROM vwBusinessSearchResult
WHERE bBusiness LIKE '%' + @.Business + '%'
AND bID Exists In(SELECT bbtBusinessID
FROM tblBusinessBusinessType
WHERE bbtBusinessTypeID = @.BusinessTypeID)
END
WHEN 6 THEN
-- Search for Account and Business type id
BEGIN
SELECT * FROM vwBusinessSearchResult
WHERE bAccount LIKE '%' + @.Account + '%'
AND bID Exists In(SELECT bbtBusinessID
FROM tblBusinessBusinessType
WHERE bbtBusinessTypeID = @.BusinessTypeID)
END
WHEN 7 THEN
-- Search for Business name, Account and Business type id
BEGIN
SELECT * FROM vwBusinessSearchResult
WHERE bBusiness LIKE '%' + @.Business + '%'
AND bAccount LIKE '%' + @.Account + '%'
AND bID Exists In(SELECT bbtBusinessID
FROM tblBusinessBusinessType
WHERE bbtBusinessTypeID = @.BusinessTypeID)
END
WHEN 10 THEN
-- Only Search for Contact name
BEGIN
SELECT * FROM vwBusinessContactSearchResult
WHERE cFullName LIKE '%' + @.Contact + '%'
END
WHEN 11 THEN
-- Only search for Contact type id
BEGIN
SELECT * FROM vwBusinessContactSearchResult
WHERE cID Exists In(SELECT cctContactID
FROM tblContactContactType
WHERE cctContactTypeID = @.ContactTypeID)
END
WHEN 21 THEN
-- Search for Contact name name Contact type id
BEGIN
SELECT * FROM vwBusinessContactSearchResult
WHERE cFullName LIKE '%' + @.Contact + '%'
AND cID Exists In(SELECT cctContactID
FROM tblContactContactType
WHERE cctContactTypeID = @.ContactTypeID)
END
END
GO
GRANT EXECUTE ON GetSearchResult TO PUBLIC
GO
Can you please give me advice regarding my approach to facilitating a search
form and corrections for more stored procedure
Many thanks
Jonathan ParminterIf the user doen't select an entry what gets passed in?
if null then
SELECT * FROM vwBusinessSearchResult
where Account like '%' + coalesce(@.Account, '') + '%'
and Business like '%' + coalesce(@.Business, '') + '%'
and Contact like '%' + coalesce(@.Contact, '') + '%'
and BusinessTypeID = coalesce(@.BusinessTypeID, BusinessTypeID)
and ContactID = coalesce(@.ContactID, ContactID)
and ContactTypeID = coalesce(@.ContactTypeID, ContactTypeID)
if empty string and 0 from the IDs then
SELECT * FROM vwBusinessSearchResult
where Account like '%' + @.Account + '%'
and Business like '%' + @.Business + '%'
and Contact like '%' + @.Contact + '%'
and (BusinessTypeID = @.BusinessTypeID or @.BusinessTypeID = 0)
and (ContactID = @.ContactID or @.ContactID = 0)
and (ContactTypeID = @.ContactTypeID or @.ContactTypeID = 0)|||Nigel, excellant
--
Many thanks
Jonathan Parminter
"Nigel Rivett" wrote:

> If the user doen't select an entry what gets passed in?
> if null then
> SELECT * FROM vwBusinessSearchResult
> where Account like '%' + coalesce(@.Account, '') + '%'
> and Business like '%' + coalesce(@.Business, '') + '%'
> and Contact like '%' + coalesce(@.Contact, '') + '%'
> and BusinessTypeID = coalesce(@.BusinessTypeID, BusinessTypeID)
> and ContactID = coalesce(@.ContactID, ContactID)
> and ContactTypeID = coalesce(@.ContactTypeID, ContactTypeID)
> if empty string and 0 from the IDs then
> SELECT * FROM vwBusinessSearchResult
> where Account like '%' + @.Account + '%'
> and Business like '%' + @.Business + '%'
> and Contact like '%' + @.Contact + '%'
> and (BusinessTypeID = @.BusinessTypeID or @.BusinessTypeID = 0)
> and (ContactID = @.ContactID or @.ContactID = 0)
> and (ContactTypeID = @.ContactTypeID or @.ContactTypeID = 0)
>|||Nigel,
Just curious as to the use of coalesce on the @.account, @.business, and
@.contact (given it wasn't the first thing that sprang to mind for me.
Is there any difference performance wise between using coalesce() in
this fashion vs isnull() ?
Glenn|||Jonathan (Jonathan@.discussions.microsoft.com) writes:
> IF @.ContactTypeID > 0
> SET @.SearchOptions = @.SearchOptions + 11
> CASE @.SearchOptions
> WHEN 1 THEN
There is no CASE statement in Transact-SQL. There is a CASE *expression*
which can be used in WHERE clauses, SELECT lists or anywhere else you
can use an expression.
To achieve the same logic, you would have to use bunch of IF ELSE.
For a longer discussion on this particular problem - dynamic search
conditions - I have an article on my web site that discusses a number
of alternatives: http://www.sommarskog.se/dyn-search.html.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||>> Is there any difference performance wise between using coalesce() in
this fashion vs isnull() ? <<
COALESCE () is Standard SQL and takes a list of parameters. It is a
member fo the CASE expression family.
COALESCE correctly promotes its arguments to the highest data type in
the expression:
13 / COALESCE(CAST(NULL AS INTEGER), 2.00) = 6.5
The proprietary ISNULL() uses the first data type and gets things wrong
13 / ISNULL(CAST(NULL AS INTEGER), 2.00) = 6
You would need to write:
13 / ISNULL(CAST(NULL AS DECIMAL(4,2)), 2.00)

Saturday, February 11, 2012

#region question in vb.net

What are the benefits of using
#region
...
# end region
in our programming languages like vb.net.
Why we use this block?

please tell me if any person know

thanking you

Keep in Touch


It lets you expand and collapse that region of code in development environments such as Visual Studio. Some people also use it to group class members. That's it, it doesn't affect the behavior of your code in any way.