|
|
Hi All,
I need to deallocate normal variable that has been declared in Stored Procedure in SQL Server.
So how i could achieve this?
Thanks in advance,
Rachit Damani.
|
|
|
|
|
rachitdamani wrote: I need to deallocate normal variable that has been declared in Stored Procedure in SQL Server.
I don't understand what you mean by this. Why would you want to deallocate a variable?
|
|
|
|
|
Can you explain this little bit more, if you want to just reinitializes various variables used in SP then use set statement with variable...
Regards,
Jaiprakash M Bankolli
jaiprakash.bankolli@gmail.com
http://jaiprakash.blog.com/
|
|
|
|
|
rachitdamani wrote: I need to deallocate normal variable that has been declared in Stored Procedure in SQL Server.
Will be automatically deallocated when it is out of scope
|
|
|
|
|
Hi There,
Is there a way in which Sqlserver can notify the dotnet application when a new column is added . i believe we can not use Query notifiaction here(correct me if i am wrong) .i am using sqlserver 2005 and dotnet 2.0 .
if anybody have an idea of how to do this or know any link in this regard,please share with me.
Hope i am clear
Cheers
Deepak
|
|
|
|
|
If you are using MS SQL2005 then I think this should be possible with notification services.
Regards,
Jaiprakash M Bankolli
jaiprakash.bankolli@gmail.com
http://jaiprakash.blog.com/
|
|
|
|
|
Howdy All
I'm new to C#, recently converted from Java. I'm still learning the coding differences.
One that I have seen around a fair bit is data access code. Below is a code fragment for accessing a database. Normally (in Java) I would use try/catch/finally for surround the connection etc. In C# the using statement works well for cleaning up the connection (if I understand it correctly). In bold I have added code that handles and logs the exception then throws it up to the next tier. I don't see many (or any) examples with a try catch block inside a using statement (the bold code). Is there reason for this?
Any advice for writing DAL code (not using datasets)
public static bool Delete(int supplierID)
{
int result = 0;
using (SqlConnection myConnection = new SqlConnection(AppConfiguration.ConnectionString))
{
SqlCommand myCommand = new SqlCommand("sprocProcSupplierDelete", myConnection);
myCommand.CommandType = CommandType.StoredProcedure;
myCommand.Parameters.Add(Parameters.SupplierID);
myCommand.Parameters[ParameterNames.SupplierID].Value = supplierID;
try
{
myConnection.Open();
result = myCommand.ExecuteNonQuery();
myConnection.Close();
}
catch (SQLException e)
{
...
...
throw;
}
}
return result > 0;
}
Thanks heaps for any help
|
|
|
|
|
Quinten.Miller wrote: I don't see many (or any) examples with a try catch block inside a using statement (the bold code). Is there reason for this?
Possibly they don't want to handle the exception at that point.
Also, remember that much example code will leave out exception handling to improve the clarity of the code that is being shown. Whether that is a good thing or not, I don't know.
From my own point of view. I normally find that at this point in my code I can't do anything with the exception so I just let it continue to unwind. I don't log it at this point because the call stack is too short to be useful also - it will show me from my DAL method into the ADO.NET code, but it won't show me what called the DAL method and that is often more useful in tracking down a bug. So, I let the stack unwind a bit before logging anything.
|
|
|
|
|
I advice you to use
try
{
myConnection.Open();
result = myCommand.ExecuteNonQuery();
}
catch (SQLException e)
{
// handle exception
...
// log exception
...
throw;
}
finally
{
myConnection.Close();
}
This is a good using of try/catch/finally. Using statement dispose object which created after using in
body of statement.
Return to innocence
|
|
|
|
|
Is it a good idea to have my Data Access Layer on Web Service?
What I mean is, All communication of different tier with the underlying database must all be done using XML web sevices.
What are the Cons and Pros of my idea?
Thanks in Advance.
|
|
|
|
|
Mark Anthony Sabado wrote: Is it a good idea to have my Data Access Layer on Web Service?
Yes. It is a good idea to have a DAL in a webservice.
Mark Anthony Sabado wrote: What I mean is, All communication of different tier with the underlying database must all be done using XML web sevices.
Well, if the other tiers of the application are over an internet connection then that's the safest way to go.
If the other tiers of the application are on the same LAN as the database then you are just adding in an extra layer of slowness. Unless the webservice adds something of value over calling to the database direct then don't use that in a LAN environment.
|
|
|
|
|
Hi All,
I have taken a backup from ABC Database which was stored in SQL Server 2000 server.
Now I need to restore the same backup to same DB which is in SQL Server 2005.
Can I do this operation successfully?
Thanks in advance.
|
|
|
|
|
YES.
it is possible to restore, backup of SQL Server 2000, in SQL Server 2005.
Regards
KP
|
|
|
|
|
But it's worth remembering that you cannot go back - you cannot restore a SQL Server 2005 database backup on SQL Server 2000 server.
|
|
|
|
|
YES.
backword compatibility is possible. But the other is not
Regards
KP
|
|
|
|
|
hi,
how to play music during the processes of downloading a document in webapplication.
p.sethi
|
|
|
|
|
This is not the right forum to ask such a question.
Mubashir
Every job is a self portrait of the person who did it.
|
|
|
|
|
|
You might also want to consider how annoying that could become and the fact that you're taking up valuable bandwidth streaming the music along with whatever you're downloading...
I for one would just quit the download and leave.
|
|
|
|
|
I'm new in mssql. I was trying various ways, but no luck.
I have two tables "jobs" and "measures".
JOBS fields are:
[U]JOBID JOBNAME MEASURE[/U]
1 programming 11
2 corbel 22
MEASURES fields:
[U]ID MEASURE[/U]
11 hours
22 lb
[U]The result should be:[/U]
1 programming hours
2 corbel lb
Regards Arthur S.
|
|
|
|
|
Hi,
try the following
Select jobs.JOBID, JOBS.JOBNAME, MEASURES.MEASURE
from JOBS, MEASURES
WHERE JOBS.MEASURE = MEASURES.ID
Mubashir
Every job is a self portrait of the person who did it.
|
|
|
|
|
SELECT j.jobid, j.jobname, m.measure
FROM Jobs j
INNER JOIN Measures m ON j.measure = m.id
Regards
KP
|
|
|
|
|
Hi,
Im inserting into one column image at the same time text. but when I insert data I get this error:
Specified argument was out of the range of valid values. Parameter name: Images/laughing.gif
Why is it so?
Thanks
|
|
|
|
|
nclauder wrote: Im inserting into one column image at the same time text
Where r u inserting the this data?
Mubashir
Every job is a self portrait of the person who did it.
|
|
|
|