HighTechTalks DotNet Forums  

Is SQL 2000 tran working with VS2008?

ASP.net ASP.net discussions (microsoft.public.dotnet.framework.aspnet)


Discuss Is SQL 2000 tran working with VS2008? in the ASP.net forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #11  
Old   
aspfun via DotNetMonster.com
 
Posts: n/a

Default Re: Is SQL 2000 tran working with VS2008? - 02-08-2010 , 11:08 AM






Alexey Smirnov wrote:
Quote:
Are you sure that you execute SP from ASP.NET, does it work when table
is not renamed?
[quoted text clipped - 46 lines]
--
Message posted via DotNetMonster.comhttp://www.dotnetmonster.com/Uwe/Forums.aspx/asp-net/201002/1

Here's the code that works

SqlConnection conn = null;

try
{
conn = new SqlConnection("....");
conn.Open();

SqlCommand cmd = new SqlCommand("DeleteDepartment",
conn);
SqlParameter p = new SqlParameter("@DepartmentID",
xxx);
cmd.Parameters.Add(p);
cmd.CommandType = CommandType.StoredProcedure;
cmd.ExecuteNonQuery();
}
catch (Exception ex)
{
Response.Write("Error: " + ex.Message);
}
finally
{
if (conn != null)
{
conn.Close();
}
}

Tested against SQL Server 2000 - 8.00.2187 (x86) Enterprise Edition
(Build 2195: Service Pack 4)

Hope this helps
Thank you. I'll test it.
I just check sql server in our company, they are only have sp2 installed.
(sp4 is available for a long time). Is it cause problem of not catching error?


--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/Forums.aspx/asp-net/201002/1

Reply With Quote
  #12  
Old   
Alexey Smirnov
 
Posts: n/a

Default Re: Is SQL 2000 tran working with VS2008? - 02-08-2010 , 01:13 PM






On 8 Feb., 17:08, "aspfun via DotNetMonster.com" <u53138@uwe> wrote:
Quote:
Alexey Smirnov wrote:
Are you sure that you execute SP from ASP.NET, does it work when table
is not renamed?
[quoted text clipped - 46 lines]
--
Message posted via DotNetMonster.comhttp://www.dotnetmonster.com/Uwe/Forums.aspx/asp-net/201002/1

Here's the code that works

SqlConnection conn = null;

* * * * * *try
* * * * * *{
* * * * * * * *conn = new SqlConnection("....");
* * * * * * * *conn.Open();

* * * * * * * *SqlCommand cmd = new SqlCommand("DeleteDepartment",
conn);
* * * * * * * *SqlParameter p = new SqlParameter("@DepartmentID",
xxx);
* * * * * * * *cmd.Parameters.Add(p);
* * * * * * * *cmd.CommandType = CommandType.StoredProcedure;
* * * * * * * *cmd.ExecuteNonQuery();
* * * * * *}
* * * * * *catch (Exception ex)
* * * * * *{
* * * * * * * *Response.Write("Error: " + ex.Message);
* * * * * *}
* * * * * *finally
* * * * * *{
* * * * * * * *if (conn != null)
* * * * * * * *{
* * * * * * * * * *conn.Close();
* * * * * * * *}
* * * * * *}

Tested against SQL Server *2000 - 8.00.2187 (x86) Enterprise Edition
(Build 2195: Service Pack 4)

Hope this helps

Thank you. I'll test it.
I just check sql server in our company, they are only have sp2 installed.
(sp4 is available for a long time). Is it cause problem of not catching error?

--
Message posted via DotNetMonster.comhttp://www.dotnetmonster.com/Uwe/Forums.aspx/asp-net/201002/1
Well, I don't think that this is a server issue. I think your code was
wrong

Reply With Quote
  #13  
Old   
aspfun via DotNetMonster.com
 
Posts: n/a

Default Re: Is SQL 2000 tran working with VS2008? - 02-08-2010 , 01:46 PM



Alexey Smirnov wrote:
Quote:
Are you sure that you execute SP from ASP.NET, does it work when table
is not renamed?
[quoted text clipped - 42 lines]
--
Message posted via DotNetMonster.comhttp://www.dotnetmonster.com/Uwe/Forums.aspx/asp-net/201002/1

Well, I don't think that this is a server issue. I think your code was
wrong
I checked my code, it is the same as yours.

Protected Function Test(ByVal _id As Integer) As Boolean
Dim myDSN As String = ConfigurationManager.AppSettings("ConnectionString ")
//get connection from web.config
Dim myConn As New SqlConnection(myDSN)
Dim mySQLCommand As New SqlCommand("sSQLTransation", myConn)
mySQLCommand.CommandType = CommandType.StoredProcedure

Dim prmid As New SqlParameter("@DepartmentID", SqlDbType.Int, 4)
prmid.Value = _id
mySQLCommand.Parameters.Add(prmid)

Using myConn
Try
myConn.Open()
mySQLCommand.ExecuteNonQuery()
myConn.Close()
Return True
Catch ex As SqlException
Me.lblMessagebar.Text = ex.Message
Return False
Finally
If myConn IsNot Nothing Then
myConn.Close()
End If
End Try
End Using
End Function

--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/Forums.aspx/asp-net/201002/1

Reply With Quote
  #14  
Old   
Mr. Arnold
 
Posts: n/a

Default Re: Is SQL 2000 tran working with VS2008? - 02-08-2010 , 07:05 PM



Alexey Smirnov wrote:
Quote:
On 8 Feb., 17:08, "aspfun via DotNetMonster.com" <u53138@uwe> wrote:
Alexey Smirnov wrote:
Are you sure that you execute SP from ASP.NET, does it work when table
is not renamed?
[quoted text clipped - 46 lines]
--
Message posted via DotNetMonster.comhttp://www.dotnetmonster.com/Uwe/Forums.aspx/asp-net/201002/1
Here's the code that works
SqlConnection conn = null;
try
{
conn = new SqlConnection("....");
conn.Open();
SqlCommand cmd = new SqlCommand("DeleteDepartment",
conn);
SqlParameter p = new SqlParameter("@DepartmentID",
xxx);
cmd.Parameters.Add(p);
cmd.CommandType = CommandType.StoredProcedure;
cmd.ExecuteNonQuery();
}
catch (Exception ex)
{
Response.Write("Error: " + ex.Message);
}
finally
{
if (conn != null)
{
conn.Close();
}
}
Tested against SQL Server 2000 - 8.00.2187 (x86) Enterprise Edition
(Build 2195: Service Pack 4)
Hope this helps
Thank you. I'll test it.
I just check sql server in our company, they are only have sp2 installed.
(sp4 is available for a long time). Is it cause problem of not catching error?

--
Message posted via DotNetMonster.comhttp://www.dotnetmonster.com/Uwe/Forums.aspx/asp-net/201002/1

Well, I don't think that this is a server issue. I think your code was
wrong
Hear! Hear! ADO.NET and SQL server have been around a long time for it
to be a SQL server issue.

The OP is doing something wrong in code.

Reply With Quote
  #15  
Old   
Alexey Smirnov
 
Posts: n/a

Default Re: Is SQL 2000 tran working with VS2008? - 02-09-2010 , 02:42 AM



On Feb 8, 7:46*pm, "aspfun via DotNetMonster.com" <u53138@uwe> wrote:
Quote:
Alexey Smirnov wrote:
Are you sure that you execute SP from ASP.NET, does it work when table
is not renamed?
[quoted text clipped - 42 lines]
--
Message posted via DotNetMonster.comhttp://www.dotnetmonster.com/Uwe/Forums.aspx/asp-net/201002/1

Well, I don't think that this is a server issue. I think your code was
wrong

I checked my code, it is the same as yours.

There are few things in your code where it might be wrong.

1) sSQLTransation is not the same stored procedure
2) check if ConfigurationManager.AppSettings("ConnectionString ")
returns correct database
3) check if lblMessagebar is visible and you don't change its text
after calling the Test() function

It must be something in the code. Try to simplify it as much as
possible (for example, create a test page where you run only one
function and see what happens)

Hope this helps.

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.