Click here to Skip to main content
16,005,339 members
Home / Discussions / Database
   

Database

 
QuestionHow to shift My Sql data to Sql Server Pin
srilu nagalla19-Oct-06 20:49
srilu nagalla19-Oct-06 20:49 
AnswerRe: How to shift My Sql data to Sql Server Pin
Edbert P19-Oct-06 21:11
Edbert P19-Oct-06 21:11 
Questionwhere can find A CADOConnection CLASS package Pin
swgzj19-Oct-06 17:56
swgzj19-Oct-06 17:56 
AnswerRe: where can find A CADOConnection CLASS package Pin
S Douglas23-Oct-06 0:58
professionalS Douglas23-Oct-06 0:58 
GeneralSqlParameter was expected, but it's been given! Pin
Ed.Poore19-Oct-06 13:28
Ed.Poore19-Oct-06 13:28 
GeneralRe: SqlParameter was expected, but it's been given! Pin
Colin Angus Mackay19-Oct-06 13:43
Colin Angus Mackay19-Oct-06 13:43 
GeneralRe: SqlParameter was expected, but it's been given! Pin
Ed.Poore19-Oct-06 14:00
Ed.Poore19-Oct-06 14:00 
GeneralRe: SqlParameter was expected, but it's been given! Pin
Ed.Poore19-Oct-06 14:11
Ed.Poore19-Oct-06 14:11 
Ok here's the code (putting the @ in made no difference)

Stored Procedure:
ALTER PROCEDURE dbo.UpdateAssembler (@Id int, @Name char(20), @IsActive bit, @Stamp timestamp) AS
BEGIN
    IF EXISTS(SELECT * FROM Assembler WHERE ID = @Id)
        /* Check the TimeStamp */
        IF EXISTS(SELECT * FROM Assembler WHERE (ID = @Id AND Stamp = @Stamp))
            UPDATE Assembler
                SET Name = @Name,
                    IsActive = @IsActive
                WHERE ID = @Id
        ELSE
            RAISERROR('Different TimeStamps',10,1)
    ELSE
        INSERT INTO Assembler
            (Name, IsActive)
            VALUES (@Name, @IsActive)
END
Building the SqlCommand (in a semi-factory like method thingy-ma-bob):
// Build the Command
SqlCommand command = new SqlCommand("UpdateAssembler");
command.CommandType = CommandType.StoredProcedure;

command.Parameters.Add("Id", SqlDbType.Int);
command.Parameters.Add("Stamp", SqlDbType.Timestamp);
command.Parameters["Id"].IsNullable = true;
command.Parameters["Stamp"].IsNullable = true;
Executing the command:
updateCommand.Parameters["Id"].Value = item.Id;			// an int? object
updateCommand.Parameters["Stamp"].Value = item.TimeStamp;	// byte[]
updateCommand.ExecuteNonQuery();
Note that certain irrelevant bits have been cut out.


Sig cops got me...

GeneralRe: SqlParameter was expected, but it's been given! Pin
Colin Angus Mackay19-Oct-06 14:28
Colin Angus Mackay19-Oct-06 14:28 
GeneralRe: SqlParameter was expected, but it's been given! Pin
Ed.Poore19-Oct-06 22:45
Ed.Poore19-Oct-06 22:45 
GeneralRe: SqlParameter was expected, but it's been given! Pin
Ed.Poore22-Oct-06 21:39
Ed.Poore22-Oct-06 21:39 
GeneralRe: SqlParameter was expected, but it's been given! Pin
Mairaaj Khan20-Oct-06 0:07
professionalMairaaj Khan20-Oct-06 0:07 
GeneralRe: SqlParameter was expected, but it's been given! Pin
Ed.Poore21-Oct-06 7:55
Ed.Poore21-Oct-06 7:55 
QuestionHow to fill null data in control froms in VB.Net Pin
rehan_cop19-Oct-06 7:09
rehan_cop19-Oct-06 7:09 
AnswerRe: How to fill null data in control froms in VB.Net Pin
Mairaaj Khan19-Oct-06 22:34
professionalMairaaj Khan19-Oct-06 22:34 
Questionselecting data for crystal reports Pin
haseeb_saeed18-Oct-06 21:14
haseeb_saeed18-Oct-06 21:14 
Questioncatching sql exception type Pin
DownBySpj18-Oct-06 21:01
DownBySpj18-Oct-06 21:01 
AnswerRe: catching sql exception type Pin
Colin Angus Mackay19-Oct-06 5:18
Colin Angus Mackay19-Oct-06 5:18 
AnswerRe: SQL error :Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.??? [help] Pin
Mike Dimmick19-Oct-06 6:51
Mike Dimmick19-Oct-06 6:51 
Questionhow to display daily sales between the date? [urgent] Pin
campbells18-Oct-06 18:58
campbells18-Oct-06 18:58 
AnswerRe: how to display daily sales between the date? [urgent] Pin
Edbert P19-Oct-06 15:25
Edbert P19-Oct-06 15:25 
GeneralRe: how to display daily sales between the date? [urgent] Pin
campbells19-Oct-06 15:49
campbells19-Oct-06 15:49 
GeneralRe: how to display daily sales between the date? [urgent] Pin
Edbert P19-Oct-06 16:02
Edbert P19-Oct-06 16:02 
GeneralRe: how to display daily sales between the date? [urgent] Pin
Edbert P19-Oct-06 16:04
Edbert P19-Oct-06 16:04 
GeneralRe: how to display daily sales between the date? [urgent] Pin
campbells19-Oct-06 16:37
campbells19-Oct-06 16:37 

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.