Click here to Skip to main content
15,912,977 members
Home / Discussions / Database
   

Database

 
GeneralRe: Array fo MySqlDataAdapter Pin
Tomy140213-Dec-06 17:49
Tomy140213-Dec-06 17:49 
GeneralRe: Array fo MySqlDataAdapter Pin
Andy Brummer13-Dec-06 18:44
sitebuilderAndy Brummer13-Dec-06 18:44 
GeneralRe: Array fo MySqlDataAdapter Pin
Tomy140213-Dec-06 18:49
Tomy140213-Dec-06 18:49 
QuestionHow to establish remote connection Pin
kani9813-Dec-06 13:03
kani9813-Dec-06 13:03 
AnswerRe: How to establish remote connection Pin
Andy Brummer13-Dec-06 17:43
sitebuilderAndy Brummer13-Dec-06 17:43 
AnswerRe: How to establish remote connection Pin
Rob Graham14-Dec-06 4:26
Rob Graham14-Dec-06 4:26 
GeneralRe: How to establish remote connection Pin
kani9814-Dec-06 5:17
kani9814-Dec-06 5:17 
QuestionStored Procedure Pin
tommypa7513-Dec-06 10:52
tommypa7513-Dec-06 10:52 
Hello,
I have the following problem:

Let's say I have some small database with one table named "Activations" with two fields employeeID, date.
In order to add some row to the table I created stored procedure which looks like this:

<code>
CREATE PROCEDURE Activate
(
@employeeID int
)
AS
BEGIN TRANSACTION Activate
INSERT INTO Activations
(employeeID,date)
VALUES(@employeeID, GETDATE())
COMMIT TRANSACTION
</code>

In order to invoke this procedure I use the following code:
<code>
string connectionString = ConfigurationManager.ConnectionStrings["BazaConnection"].ConnectionString;
SqlConnection con = new SqlConnection(connectionString);
SqlCommand cmd = new SqlCommand();
cmd.Parameters.Add(new SqlParameter("@employeeID", SqlDbType.Int, 4));
cmd.Parameters["@employeeID"].Value = 66; // some value
cmd.CommandText = "Activate";
cmd.CommandType = CommandType.StoredProcedure;
try
{
con.Open();
cmd.Connection = con;
int rowsAffected = cmd.ExecuteNonQuery();
Console.WriteLine("Rows affected: " + rowsAffected);
}
catch (Exception err)
{
Console.WriteLine(err.Message);
}
finally
{
con.Dispose();
con.Close();
}
</code>

After executing this code it says that 1 row has been affected but when
I browse contents of the Activations table there isn't any value. Everything
works fine when I execute stored procedure using Database Explorer in visual c# express edition.

Any idea what's wrong ?
I use sql server 2005 express edition
Thanks

--
Regards
tommy
AnswerRe: Stored Procedure Pin
Private_Void13-Dec-06 11:58
Private_Void13-Dec-06 11:58 
GeneralRe: Stored Procedure Pin
tommypa7514-Dec-06 9:43
tommypa7514-Dec-06 9:43 
QuestionMS-SQL Stored Procedures returning both parameters and recordset Pin
Leo Smith13-Dec-06 8:38
Leo Smith13-Dec-06 8:38 
AnswerRe: MS-SQL Stored Procedures returning both parameters and recordset Pin
Pete O'Hanlon14-Dec-06 0:38
mvePete O'Hanlon14-Dec-06 0:38 
GeneralRe: MS-SQL Stored Procedures returning both parameters and recordset Pin
Leo Smith14-Dec-06 12:33
Leo Smith14-Dec-06 12:33 
QuestionIntellisense in SSMS available Pin
Steve Schaneville13-Dec-06 6:24
professionalSteve Schaneville13-Dec-06 6:24 
AnswerRe: Intellisense in SSMS available Pin
Pete O'Hanlon14-Dec-06 1:05
mvePete O'Hanlon14-Dec-06 1:05 
QuestionLinked Server and query analyzer [modified] Pin
Tuwing.Sabado13-Dec-06 5:42
Tuwing.Sabado13-Dec-06 5:42 
AnswerRe: Linked Server and query analyzer Pin
Andy Brummer13-Dec-06 6:23
sitebuilderAndy Brummer13-Dec-06 6:23 
GeneralRe: Linked Server and query analyzer [modified] Pin
Tuwing.Sabado13-Dec-06 14:52
Tuwing.Sabado13-Dec-06 14:52 
AnswerRe: Linked Server and query analyzer Pin
Frank Kerrigan14-Dec-06 3:36
Frank Kerrigan14-Dec-06 3:36 
Questionwhy using variable in where clauses cause poor performance? Pin
zhangxinghai13-Dec-06 1:08
zhangxinghai13-Dec-06 1:08 
AnswerRe: why using variable in where clauses cause poor performance? Pin
Pete O'Hanlon13-Dec-06 2:06
mvePete O'Hanlon13-Dec-06 2:06 
GeneralRe: why using variable in where clauses cause poor performance? Pin
zhangxinghai13-Dec-06 13:36
zhangxinghai13-Dec-06 13:36 
AnswerRe: why using variable in where clauses cause poor performance? Pin
Colin Angus Mackay13-Dec-06 2:53
Colin Angus Mackay13-Dec-06 2:53 
Questionquery? Pin
Ravi Shankar4312-Dec-06 18:26
Ravi Shankar4312-Dec-06 18:26 
AnswerRe: query? Pin
Colin Angus Mackay12-Dec-06 22:28
Colin Angus Mackay12-Dec-06 22:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.