|
-
Sep 4th, 2003, 01:35 PM
#1
Thread Starter
Frenzied Member
Convert functions to C#
I wrote this functions while doing ASP programming, but now that I am doing C# programming, I was wondering if it would be possible to convert my ASP functions into C#? They are primarily for database actions (i.e. opening, querying, closing)
VB Code:
function db_open(connectionStringPayload)
if isObject(objConn) then
if objConn.state = 0 then
set objConn = server.createObject("ADODB.CONNECTION")
objConn.open connectionStringPayload
db_open = true
else
db_open = false
end if
else
set objConn = server.createObject("ADODB.CONNECTION")
objConn.open connectionStringPayload
db_open = true
end if
end function
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
-
Sep 8th, 2003, 02:39 AM
#2
Here's an exact translation to C#, but you'd want to use ASP.Net instead.
Code:
bool db_open(string connectionStringPayload)
{
if(objConn != null) {
if(objConn.state == 0) {
objConn = server.createObject("ADODB.CONNECTION");
objConn.open(connectionStringPayload);
return true;
} else {
return false;
}
} else {
objConn = server.createObject("ADODB.CONNECTION");
objConn.open(connectionStringPayload);
return true;
}
}
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|