Ah, that's perfect, thanks. Would've preferred the easier WinForm methods of having it in the solution, but not complaining :)
Andreas_1983
Posts
-
No Designer View (VS2008 C++) -
No Designer View (VS2008 C++)Hi, Thanks for the reply. I have the professional edition but still no luck :(
-
No Designer View (VS2008 C++)Hi, I'm using Visual Studio 2008 and seem to have a problem with the form designer. I'm new to MFC and want to create a project that allows me to use the form designer. I create a new MFC application form and all the code is created. When I build and run this project, there is a basic window with a few components. However, I can only seem to see the code for this application. Is it possible for my to open this in the form designer and manually edit the form in the editor rather than through code? Thanks
-
Efficient way of accessing a Boolean from SQL ServerThanks to both you guys :) I ended up making my SP simpler:
...
SELECT [Valid] FROM tUsers WHERE ID = @ID
...I then used
ExecuteScalar()
and it works great! One question though, what if the value returned from the DB isNULL
? I've set the column to disallowNULL
values but I thought it should probably have something in the code too, just in case :) Lastly, is there a best practice for this sort of thing in terms of performance? -
Efficient way of accessing a Boolean from SQL ServerHi, I don't know if this was more suited to the database message board or not but I think my question is more to do with my code rather than the database. I have a basic table with a few columns. One of them is a Bit type and is effectively a flag. All I want to do is get the flag value for a given ID. I've tried using an output parameter in a stored procedure but I don't know the best way of retrieving the flag value and converting it to a Boolean in code. I don't think a SqlDataReader is ideal because it's only one value I want to return.
ALTER PROCEDURE SP_UserValid
@ID INT,
@Valid BIT OUTPUT
AS
SET NOCOUNT ON;
SET @Valid = (SELECT [Valid] FROM tUsers WHERE ID = @ID)Here's my code:
SqlConnection connection = new SqlConnection(_ConnectionString);
SqlCommand cmd = new SqlCommand();
cmd.Connection = connection;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "SP_UserValid";
cmd.Parameters.Add(new SqlParameter("@ID", userID));
cmd.Parameters.Add(new SqlParameter("@Valid", bValid));
cmd.Parameters["@Valid"].SqlDbType = SqlDbType.Bit;
cmd.Parameters["@Valid"].Direction = ParameterDirection.InputOutput;connection.Open();
cmd.ExecuteNonQuery();// How do I get the "Valid" as a Boolean value?
cmd.Connection.Close()
Thanks for looking :)