Uniqueidentifier And Combobox

Nov 26, 2007

Hello all,

I would like to put another line into my combo box using this SQL statement but this part "(select newid() as QuestionID, 'Select a Question' as QuestionText)" is not working.   (select newid() as QuestionID, 'Select a Question as QuestionText) union all (SELECT * FROM (SELECT TOP 100 * FROM [dbo.aspnet_Questions]) as tbl)

RETURN

It gives me an error: Invalid object name 'dbo.aspnet_Questions'.  Can anybody please help me with this error? 

Thank you,
Vic. 

View 5 Replies


ADVERTISEMENT

Combobox Width

Oct 2, 2007

Hello,

How can I change the width of my comboboxes etc in SQL Enterprise Manager ?

I can't see which table I'm supposed to be updating and it's causing me huge problems.
(basically my fields are called things like Staging_EmployeeDetails etc)

I'm on a 17" monitor with a resolution of 1280 x 1024 so this shouldn't be an issue, and all screens are maximized.

I've tried dragging the corners of the window, but it doesn't seem to let me.

As an example, I'm in the export wizard and I can't tell which rowto use when I query the data (See screenshot)

View 1 Replies View Related

Filter Using A Combobox

May 13, 2006

Hello everyone,

I am working on a filter function for my sql database (C#), and am running into a bit of difficulties, and I thought I'd ask if someone can see something wrong with my code.

In my program, I basically have 3 comboboxes: gendcombo, agecombo, and regioncombo. I have filled them (except region) with search criteria (I want to get the other two working first). When I hit the OnRunFilterBtn, I would like to load the filtered criteria into the ListView... which is composed of 5 items: ID, Title, Text, Age, Gend.

I'm not sure where I am going wrong with this one, and any direction would be helpful. I initially tried to load the columns (age, for example) into the combobox, but that didn't seem to want to work for me, so I went ahead and added it myself. I then tried to change the

string strSQL = "SELECT ca_titel, ca_alter, ca_sex FROM fragenkatalog";

to

string strSQL = "SELECT * FROM fragenkatalog";

which didn't work either.

I basically believe that I am either not filtering all of the columns of the database (i.e. only the three of them) and can't spit them into the listview, or that my strSQLFilter line is foul. Either way, I'm not sure what to do about it, and therefore would be very grateful for your help,



Thanks again,





Martina



Here's the code, if it helps. If I have not provided enough, please let me know. :)

Thanks,

M.

// agecombo

//

this.agecombo.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular);

this.agecombo.Items.Add("");

this.agecombo.Items.Add("0");

this.agecombo.Items.Add("1");

this.agecombo.Items.Add("2");

this.agecombo.Items.Add("3");

this.agecombo.Items.Add("4");

this.agecombo.Items.Add("5");

this.agecombo.Items.Add("6");

this.agecombo.Items.Add("7");

this.agecombo.Items.Add("8");

this.agecombo.Items.Add("9");

this.agecombo.Items.Add("10");

this.agecombo.Items.Add("11");

this.agecombo.Items.Add("12");

this.agecombo.Items.Add("13");

this.agecombo.Items.Add("14");

this.agecombo.Items.Add("15");

this.agecombo.Items.Add("16");

this.agecombo.Items.Add("17");

this.agecombo.Items.Add("18");

this.agecombo.Items.Add("999");

this.agecombo.Location = new System.Drawing.Point(48, 16);

this.agecombo.Size = new System.Drawing.Size(80, 21);

//

// regioncombo

//

this.regioncombo.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular);

this.regioncombo.Location = new System.Drawing.Point(48, 40);

this.regioncombo.Size = new System.Drawing.Size(80, 21);

//

// gendcombo

//

this.gendcombo.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular);

this.gendcombo.Items.Add("");

this.gendcombo.Items.Add("m");

this.gendcombo.Items.Add("f");

this.gendcombo.Items.Add("n");

this.gendcombo.Location = new System.Drawing.Point(48, 64);

this.gendcombo.Size = new System.Drawing.Size(80, 21);

//



private void OnRunFilterBtn(object sender, System.EventArgs e)

{

// the filter criteria

//ca_titel is for regioncombo, ca_alter is for agecombo, ca_sex is for gendcombo

string strSQL = "SELECT ca_titel, ca_alter, ca_sex FROM fragenkatalog";

string strSQLFilter = "";

if ( (int)gendcombo.SelectedIndex > 0 )

{



if ( strSQLFilter.Length > 0 )

{

strSQLFilter += " AND ";

}

strSQLFilter += "ca_sex = " + gendcombo.SelectedIndex.ToString();

}

if ( (int)agecombo.SelectedIndex > 0 )

{

if ( strSQLFilter.Length > 0 )

{

strSQLFilter += " AND ";

}

strSQLFilter += "ca_alter = " + agecombo.SelectedIndex.ToString();

}

if ( (int)regioncombo.SelectedIndex > 0 )

{

if ( strSQLFilter.Length > 0 )

{

strSQLFilter += " AND ";

}

strSQLFilter += "ca_titel = " + regioncombo.SelectedIndex.ToString();

}

LoadList(strSQL);

}

View 4 Replies View Related

Access ComboBox Won't Populate

Dec 13, 2005

I'm using SQLServer2000/Access 2000 .adp. The .adp has a form with 2 combo boxes. The 1st combo box is bound to a stored procedure and loads fine when the form loads. I then set the 2nd combo box's RowSource passing the value of the first into the stored proc:

Me.secondComboBox.RowSource = "EXEC dbo.proc_My2ndProc '" & Me.cboFirstComboBox & "'"
Me.cbosecondComboBox.reQuery

Why won't it work? I've set a form's RecordSource using this methof, and it works great???

Thanks,
Carl

View 1 Replies View Related

ComboBox Bounded Components

Apr 2, 2008

Hi,

I develop a application for mobile devices using C# and Visual Studio 2005 with .NET Compact Framework 2.0. My application is very sample: have a master form where user browse the records in a grid and a detail form for insert and alter the record's.

The application runs fine when the database is empty. I have a problem with combobox bounded components when the sequence above is executed:

1. After append a some of records end the application;
2. Run the application again (the records was in database);
3. Append new record;
4. Cancel the operation;

The first record of the group is changed without user confirmation. The value of each field is changed for the first value of combobox bounded with then.

Why?

The code below cause the problem:


TableBindingSource.AddNew();

DetailEditViewDialog detailEditViewDialog = DetailEditViewDialog.Instance(TableBindingSource));

detailEditViewDialog.Text = "[New]";

detailEditViewDialog.comboBoxCars.SelectedIndex = -1;

detailEditViewDialog.comboBoxPumps.SelectedIndex = -1;

detailEditViewDialog.comboBoxLines.SelectedIndex = -1;

detailEditViewDialog.ShowDialog();


Somebody can help me?

View 1 Replies View Related

One Combobox And Different Database Tables

Mar 17, 2008

I have a data-driven application with 2 Comboboxes on a VB 2005 form and and SQL Server 2005 database. I am looking to get a solution when the user, select say ACCOUNTS on Combobox1, I would like Combobox2 to get filled with the Accounts staff in the ACCOUNTS table in the database and when SALES is selected on Combobox1, Combobox2 is filled with Sales staff in the SALES table etc. I have 10 database tables in all to interchange with on Combobox2. Thanks

View 12 Replies View Related

Populate Combobox In Excel From Table

Sep 23, 2014

I have requirement to populate a combobox in excel from a table in SQL when the user opens the excel workbook. how I can do that.

View 1 Replies View Related

SSRS - Avoid ComboBox MultiValues

Jul 27, 2007



Dear Friends,
I have 4 comboboxes in a hierarchy in my report, and I need to avoid the user to select multi values in each combo... Or the user select ALL or on option...
How can I do it? Somebody knows?
Regards!

View 3 Replies View Related

To Display Two Values In Combobox But In Database Will Store Only One Value Out Of That

Jan 24, 2008



hi friends
i am using visual studio 2005. i need one combo box which will display two values. one is "Designation" i.e.("clerk,accountant,manager,officer,shopkeeper) and another "Designation ID" i.e.(1,2,3,4,5 and respectively) i made table of "Designation Master" in sql server 2000 including field of "Designation ID, Designation". manually i am inserting id and designation in that table.
what i want exactly i have one customer form which contain a "combobox" for "Designation" column i achieved "Designation ID" and "Designation" in that combo box also but when i will go for save i want that i will store only "Designation ID" i don't want to store "Designation" in my "Designation" column which is in "Customer table" i am attaching code which store "Designation ID" and "Designation" in customer table but i want only "Designation ID" only
bold line which is difficult for me to inserting only "designationId" in customer table.




Inventory_Master.cntData.Open()

cmdstr = "Select DesigID,Designation from Designation_Master"

cmd = New SqlCommand(cmdstr, Inventory_Master.cntData)

cdrCustomer = cmd.ExecuteReader()

If cdrCustomer.HasRows = True Then

While cdrCustomer.Read()

cmddesig = cdrCustomer.Item(0).ToString.PadLeft(1) + cdrCustomer.Item(1).ToString.PadLeft(25)

cbodesignation.Items.Add(cmddesig)

End While

Else

End If

Inventory_Master.cntData.Close()



Inventory_Master.cntData.Open()

cmd = New SqlCommand("insert CUSTOMER(Membership_No,Member_Initial,Member_Name,Member_Birthdate,Gender,Res_Telno,Mobile_No,Res_Addr1,Res_Addr2,Res_City,Res_Pincode,Landmark,Company_Name,Comp_Addr1,Comp_Addr2,Comp_Telno,Comp_City,Comp_Pincode,Designation,Credit_Limit,Income_Mthly,Email_ID,Note) values (@Membership_No,@Member_Initial,@Member_Name,@Member_Birthdate,@Gender,@Res_Telno,@Mobile_No,@Res_Addr1,@Res_Addr2,@Res_City,@Res_Pincode,@Landmark,@Company_Name,@Comp_Addr1,@Comp_Addr2,@Comp_Telno,@Comp_City,@Comp_Pincode,@Designation,Convert(money,@creditlimit),@Income_Mthly,@Email_ID,@Note)", Inventory_Master.cntData)

cmd.Parameters.AddWithValue("@Membership_No", txtmebno.Text)

cmd.Parameters.AddWithValue("@Member_Initial", cbomebname.Text)

cmd.Parameters.AddWithValue("@Member_Name", txtmebname.Text)

cmd.Parameters.AddWithValue("@Member_Birthdate", dtime.Value)

cmd.Parameters.AddWithValue("@Gender", cbogender.Text)

cmd.Parameters.AddWithValue("@Res_Telno", txttelno.Text)

cmd.Parameters.AddWithValue("@Mobile_No", txtmobileno.Text)

cmd.Parameters.AddWithValue("@Res_Addr1", txtresaddr1.Text)

cmd.Parameters.AddWithValue("@Res_Addr2", txtresaddr2.Text)

cmd.Parameters.AddWithValue("@Res_City", txtrescity.Text)

cmd.Parameters.AddWithValue("@Res_Pincode", txtrespin.Text)

cmd.Parameters.AddWithValue("@Landmark", txtlandmark.Text)

cmd.Parameters.AddWithValue("@Company_Name", txtcompname.Text)

cmd.Parameters.AddWithValue("@Comp_Addr1", txtcompaddr1.Text)

cmd.Parameters.AddWithValue("@Comp_Addr2", txtcompaddr2.Text)

cmd.Parameters.AddWithValue("@Comp_Telno", txtcomptelno.Text)

cmd.Parameters.AddWithValue("@Comp_City", txtcompcity.Text)

cmd.Parameters.AddWithValue("@Comp_Pincode", txtcomppin.Text)

cmd.Parameters.AddWithValue("@Designation", cbodesignation.Text.PadLeft(1, CChar(CStr(1)))) [ help me for inserting designation in this line]

cmd.Parameters.AddWithValue("@creditlimit", txtcreditlimit.Text)

cmd.Parameters.AddWithValue("@Income_Mthly", txtincomemthly.Text)

cmd.Parameters.AddWithValue("@Email_ID", txtemailid.Text)

cmd.Parameters.AddWithValue("@Note", rtxtNote.Text)

cmd.ExecuteNonQuery()

Inventory_Master.cntData.Close()

MsgBox("RECORD SAVED")


View 1 Replies View Related

Uniqueidentifier

Apr 10, 2006

I am really struggling.  I am trying to query a sql database table using a uniqueidentifier. 
Public Class SalesDataClass
Public Function getAccountNumber(ByVal ID As String) As String
Dim accountnumber As String = "0"
'Try
Using connection As New SqlConnection(ConfigurationManager.ConnectionStrings("InterhealthCRM_MSCRMConnectionString").ConnectionString)
Using command As New SqlCommand("getAccountNumber", connection)
command.CommandType = CommandType.StoredProcedure
 
Dim parameterdat1 As New SqlParameter("@accountid", SqlDbType.UniqueIdentifier)
parameterdat1.Value = ID
command.Parameters.Add(parameterdat1)
Dim parameterdat2 As New SqlParameter("@accountnum", SqlDbType.NVarChar, 20, ParameterDirection.Output)
command.Parameters.Add(parameterdat2)
connection.Open()
command.ExecuteNonQuery()
accountnumber = parameterdat2.Value
Return accountnumber
 
End Using
End Using
'Catch ex As SqlException
' Catch ex As InvalidOperationException
' Catch ex As Exception
' You might want to pass these errors
' back out to the caller.
' End Try
End Function
End Class
Can someone help me correct my code.
 
Sproc:
ALTER PROCEDURE [dbo].[getAccountNumber]
-- Add the parameters for the stored procedure here
@accountId uniqueidentifier,
@accountnum nvarchar(20) output
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
SELECT accountNumber from accountbase where accountid = @accountid
return @accountnum
END

View 2 Replies View Related

Uniqueidentifier

Jul 17, 2003

Hi,

I am using UNIQUEIDENTIFIER column for my table. I do not insert data for it. I left it on database by setting to default NEWID(). Now in my application I need the value of UNIQUEIDENTIFIER column I just inserted. Is there any function or query to get this value like in case of IDENTITY column we can get the latest inserted value from select @@IDENTITY.

Thanks and regards,
Uday

View 3 Replies View Related

Uniqueidentifier

Jan 28, 2006

Hey I was curious about the Uniqueidentifier is that better then using the @IDENTITY, apparently the Unique uses your computers mac address as a base???

View 4 Replies View Related

Uniqueidentifier

Dec 5, 2006

as above, how can i use this datatype to generate a running number for my userID ? i tried with newid() but it returns a unique 32bit.

View 10 Replies View Related

Uniqueidentifier

Apr 4, 2008



does SQLCE supports the use of uniqueidentifier datatype.and how can i use it?
i have heard that SQLCE supports only integer type as identity column.
so what datatype i should use for identification(primary key).

View 4 Replies View Related

Uniqueidentifier Inner Join Int

Nov 5, 2007

I have a table with id(uniqueidentifier) as the primary key, and another table with id(int) as the foreign key.
When I try to INNER JOIN them on id=id  in a view, I get an error that uniqueidentifier and int are incompatible.
I'm new to SQL SERVER and I consider uniqueidentifier as equal to AutoNumber in MSAccess. Isn't it so? If not, how do I make this JOIN work?

View 3 Replies View Related

Uniqueidentifier URGENT PLEASE!

Jan 26, 2008

I just want to ask if there is a passible explaination for why this code thosen't generate the proper RETURN VALUE, My coal is when a user uses the asp:CreateUserWizard i retrive GUID from the new account.With this I will check if the relation tabel has that value, so I would like to run this.
Stored Proc.
CREATE PROCEDURE proc_CustomerCheckExist@UserId uniqueidentifierASIF EXISTS (SELECT COUNT(*) FROM dbo.aspnet_LD_Customers WHERE UserId = @UserId)    Return 1ELSE    Return 0GO
Problem is if I take 2 different GUID, I still get the same result "Return 1" as true even if I dont have the GUID in my tabel row
Thanks!

View 3 Replies View Related

How Do I Get The Uniqueidentifier Of Just Inserted Row?

Apr 18, 2004

Hello there!

it was a while since i studied SQL and that brings us to my problem...

I'm creating a Stored Procedure wich first insert information in a table. That table has a uniqueidentifier fild that is default-set to newid().

later in the SP i need that uniqueidentifier value? how do I get it?

I tried this:

CREATE PROCEDURE spInsertNews
@uidArticleId uniqueidentifier = newid,
@strHeader nvarchar(300),
@strAbstract nvarchar(600),
@strText nvarchar(4000),
@dtDate datetime,
@dtDateStart datetime,
@dtDateStop datetime,
@strAuthor nvarchar(200),
@strAuthorEmail nvarchar(200),
@strKeywords nvarchar(400),
@strCategoryName nvarchar(200) = 'nyhet'
AS
INSERT INTO tblArticles
VALUES( @uidArticleId,@strHeader,@strAbstract,@strText,@dt
Date,@dtDateStart,@dtDateStop,@strAuthor,@strAutho
rEmail,@strKeywords)

declare @uidCategoryId uniqueidentifier
EXEC spGetCategoryId @strCategoryName, @uidCategoryId OUTPUT

INSERT INTO tblArticleCategory(uidArticleId, uidCategoryId)
VALUES(@uidArticleId, @uidCategoryId)


But i get an error when I EXEC the SP like this:

EXEC spInsertNews
@strHeader = 'Detta är den andra nyheten',
@strAbstract = 'dn första insatt med sp:n',
@strText = 'här kommer hela nyhetstexten att stå. Här får det plats 2000 tecken, dvs fler än vad jag orkar skriva nu...',
@dtDate = '2003-01-01',
@dtDateStart = '2003-01-01',
@dtDateStop = '2004-01-01',
@strAuthor = 'David N',
@strAuthorEmail = 'david@davi.com',
@strKeywords = 'nyhet, blajblaj, blaj'


the errormessage is: Syntax error converting from a character string to uniqueidentifier.


does anyone have a sulution to this problem?
Can I use something similar to the @@IDENTITY?
I will be greatful for any ideas...

thanks
/David, Sweden

View 8 Replies View Related

Ok To Concat A Uniqueidentifier?

Jul 8, 2004

I want to use a NEWID() to generate order numbers, but i dont want to give customers the long uniqueID. so im wondering if i concatinate it to 8 characters, if that would be safe or not...

thx in adv

View 6 Replies View Related

Return A UNIQUEIDENTIFIER

Feb 9, 2005

Hi,

I am writing a C# application that uses a SQL server database to hold its data. I need to create a stored procedure that returns a particular row's primary key value. This is no problem if the primary key is an INT. But my primary key is a unique identifier, and the stored procedure doesn't want to let me return any values that aren't INTs. Can someone please tell me how to get around this?

Thanks in advance.

Scott

View 3 Replies View Related

Problem With SP And Uniqueidentifier

Nov 28, 2005

I am trying to use a stored procedure and it seems to be giving me a error - I think it doesn't like the uniqueidentifier.   I have included the error, stored procedure, and code behind that calls the stored procedure.Thanks for any help on this!  This is the error I get:System.ArgumentException: No mapping exists from object type System.Web.UI.WebControls.TextBox to a known managed provider native type. at System.Data.SqlClient.MetaType.GetMetaTypeFromValue(Type dataType, Object value, Boolean inferLen) at System.Data.SqlClient.SqlParameter.GetMetaTypeOnly() at System.Data.SqlClient.SqlParameter.Validate(Int32 index) at System.Data.SqlClient.SqlCommand.BuildParamList(TdsParser parser, SqlParameterCollection parameters) at System.Data.SqlClient.SqlCommand.BuildExecuteSql(CommandBehavior behavior, String commandText, SqlParameterCollection parameters, _SqlRPC& rpc) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at view_WardSec_PatientLogDetail2.UpdateRecord_buttonClick(Object sender, EventArgs e) in C:Documents and SettingsKBuchanan.LMHDesktopWebSitesNewest_ERViewsview_WardSec_PatientLogDetail.aspx.vb:line 358 Here is the stored procedure:set ANSI_NULLS ONset QUOTED_IDENTIFIER ONgo
ALTER PROCEDURE [dbo].[UpdateTblVisit_WardSecPatientLog]  ( @VID decimal, @lbl_ChiefComplaint nvarchar(50),  @TriageDtTmTextBox datetime,  @PtInRmDtTmTextBox datetime,  @RnInRmDtTmTextBox datetime,  @PhyInRmDtTmTextBox datetime,  @EDHoldDisposDtTmTextBox datetime,  @DispDschDtTmTextBox datetime,  @ddlTriageNurse uniqueidentifier,  @ddlPriNurse uniqueidentifier,  @ddlEDPhy uniqueidentifier,  @ddlPriRefPhy decimal,  @ddlSecRefPhy decimal,  @ddlDschRN uniqueidentifier,  @ddlDschPhy uniqueidentifier,  @ddl_MnsArriv decimal,  @lblDschDiag nvarchar(50),  @chkbox_LogComplete bit )AS
SET NOCOUNT ON
 Update   tblVisit  SET  vChiefComplaint = @lbl_ChiefComplaint,   vTriageDtTm = @TriageDtTmTextBox,   vPtInRmDtTm = @PtInRmDtTmTextBox,   vRnInRmDtTm = @RnInRmDtTmTextBox,   vPhyInRmDtTm = @PhyInRmDtTmTextBox,   vEDHoldDisposDtTm = @EDHoldDisposDtTmTextBox,   vDispDschDtTm = @DispDschDtTmTextBox,   vTriageRnID = @ddlTriageNurse,   vRnID = @ddlPriNurse,   vEdPhyProvID = @ddlEDPhy,   vPriRefPhyProvID = @ddlPriRefPhy,   vSecRefPhyProvID = @ddlSecRefPhy,   vDschRnID = @ddlDschRN,   vDschPhyID = @ddlDschPhy,   vMnsArrvID = @ddl_MnsArriv,   vDschDiag = @lblDschDiag,   vLogCompletedInd = @chkbox_LogComplete,   vLogLastEdit = getDate() WHERE   VID = @VID    SET NOCOUNT OFF RETURN
-----------------------------------------------------------------------------Following is the codebehind for a button oncommand event.  This codeshould execute the stored procedure.-----------------------------------------------------------------------------
    Public Sub UpdateRecord_buttonClick(ByVal sender As Object, ByVal e As System.EventArgs)        'Use this to update the CareGiverID into the tbl_Visit table.        Dim sbSql As New System.Text.StringBuilder        sbSql.Append("EXEC UpdateTblVisit_WardSecPatientLog ")        sbSql.Append("@VID, ")        sbSql.Append("@lbl_ChiefComplaint, ")        sbSql.Append("@TriageDtTmTextBox, ")        sbSql.Append("@PtInRmDtTmTextBox, ")        sbSql.Append("@RnInRmDtTmTextBox, ")        sbSql.Append("@PhyInRmDtTmTextBox, ")        sbSql.Append("@EDHoldDisposDtTmTextBox, ")        sbSql.Append("@DispDschDtTmTextBox, ")        sbSql.Append("@ddlTriageNurse, ")        sbSql.Append("@ddlPriNurse, ")        sbSql.Append("@ddlEDPhy, ")        sbSql.Append("@ddlPriRefPhy, ")        sbSql.Append("@ddlSecRefPhy, ")        sbSql.Append("@ddlDschRN, ")        sbSql.Append("@ddlDschPhy, ")        sbSql.Append("@ddl_MnsArriv, ")        sbSql.Append("@lblDschDiag, ")        sbSql.Append("@chkbox_LogComplete, ")        sbSql.Append("@UserID ")
        'Response.Write(sbSql.ToString)        'Response.End()
        'Create variables for each of the edited values        Dim con As New SqlConnection(ConfigurationManager.ConnectionStrings("ERTrekker_ProdConnectionString1").ConnectionString)        Dim cmd As New SqlCommand(sbSql.ToString(), con)
        FindControls(DetailsView, "lbl_ChiefComplaint")        Dim ilbl_ChiefComplaint As TextBox = CType(MyControl, TextBox)        FindControls(DetailsView, "TriageDtTmTextBox")        Dim iTriageDtTmTextBox As TextBox = CType(MyControl, TextBox)        FindControls(DetailsView, "PtInRmDtTmTextBox")        Dim iPtInRmDtTmTextBox As TextBox = CType(MyControl, TextBox)        FindControls(DetailsView, "RnInRmDtTmTextBox")        Dim iRnInRmDtTmTextBox As TextBox = CType(MyControl, TextBox)        FindControls(DetailsView, "PhyInRmDtTmTextBox")        Dim iPhyInRmDtTmTextBox As TextBox = CType(MyControl, TextBox)        FindControls(DetailsView, "EDHoldDisposDtTmTextBox")        Dim iEDHoldDisposDtTmTextBox As TextBox = CType(MyControl, TextBox)        FindControls(DetailsView, "DispDschDtTmTextBox")        Dim iDispDschDtTmTextBox As TextBox = CType(MyControl, TextBox)        FindControls(DetailsView, "ddlTriageNurse")        Dim iddlTriageNurse As DropDownList = CType(MyControl, DropDownList)        FindControls(DetailsView, "ddlPriNurse")        Dim iddlPriNurse As DropDownList = CType(MyControl, DropDownList)        FindControls(DetailsView, "ddlEDPhy")        Dim iddlEDPhy As DropDownList = CType(MyControl, DropDownList)        FindControls(DetailsView, "ddlPriRefPhy")        Dim iddlPriRefPhy As DropDownList = CType(MyControl, DropDownList)        FindControls(DetailsView, "ddlDschRN")        Dim iddlDschRN As DropDownList = CType(MyControl, DropDownList)        FindControls(DetailsView, "ddlDschPhy")        Dim iddlDschPhy As DropDownList = CType(MyControl, DropDownList)        FindControls(DetailsView, "ddl_MnsArriv")        Dim iddl_MnsArriv As DropDownList = CType(MyControl, DropDownList)        FindControls(DetailsView, "lblDschDiag")        Dim ilblDschDiag As TextBox = CType(MyControl, TextBox)        FindControls(DetailsView, "chkbox_LogComplete")        Dim ichkbox_LogComplete As CheckBox = CType(MyControl, CheckBox)
        'Add all of the parameters to the command        With cmd.Parameters            .AddWithValue("@VID", Request("vID"))            .AddWithValue("@lbl_ChiefComplaint", ilbl_ChiefComplaint.Text.ToString)            .AddWithValue("@TriageDtTmTextBox", iTriageDtTmTextBox.Text.ToString)            .AddWithValue("@PtInRmDtTmTextBox", iPtInRmDtTmTextBox)            .AddWithValue("@RnInRmDtTmTextBox", iRnInRmDtTmTextBox.Text.ToString)            .AddWithValue("@PhyInRmDtTmTextBox", iPhyInRmDtTmTextBox.Text.ToString)            .AddWithValue("@EDHoldDisposDtTmTextBox", iEDHoldDisposDtTmTextBox.Text.ToString)            .AddWithValue("@DispDschDtTmTextBox", iDispDschDtTmTextBox.Text.ToString)            .AddWithValue("@ddlTriageNurse", iddlTriageNurse.SelectedValue.ToString)            .AddWithValue("@ddlPriNurse", iddlPriNurse.SelectedValue.ToString)            .AddWithValue("@ddlEDPhy", iddlEDPhy.SelectedValue.ToString)            .AddWithValue("@ddlPriRefPhy", iddlPriRefPhy.SelectedValue.ToString)            .AddWithValue("@ddlDschRN", iddlDschRN.SelectedValue.ToString)            .AddWithValue("@ddlDschPhy", iddlDschPhy.SelectedValue.ToString)            .AddWithValue("@ddl_MnsArriv", iddl_MnsArriv.SelectedValue.ToString)            .AddWithValue("@lblDschDiag", ilblDschDiag.Text.ToString)            .AddWithValue("@chkbox_LogComplete", ichkbox_LogComplete.Checked.ToString)            .AddWithValue("@UserID", System.Web.HttpContext.Current.Session("UserID"))
        End With
        ' Open the connection and execute the command        Try            con.Open()            If cmd.ExecuteNonQuery() < 1 Then                Throw New System.Exception("The record was not updated")            End If        Catch ex As Exception            System.Web.HttpContext.Current.Response.Write(ex.ToString())        Finally            If Not con Is Nothing AndAlso con.State = System.Data.ConnectionState.Open Then                con.Close()            End If        End Try    End Sub

View 1 Replies View Related

Foreign Key Is An Uniqueidentifier

Nov 10, 2005

Hello everyone.
I have 2 tables in MSSQL Server 2000, Products(idProduct, idProductType, name, quatity) and ProductsType(idProductType, name).

idXXXX are the primery keys and the data type is uniqueidentifier.

In table Products, the collum idProductType is a foreign key refering table ProductsType.

I can insert as many product types as i want without any problems.
Insert INTO ProductsType(name) VALUES('milk')

When inserting products i use the idProductType that was automatacly generated in last insert.
INSERT INTO Products (uuidProductType,name,quantity,)
VALUES ('AD9388A3-CA86-482D-B57F-6FA068E7D405','President Milk 50cl',500)

but i got the following error in SQL Query Analyzer:
Server: Msg 8169, Level 16, State 2, Line 1
Syntax error converting from a character string to uniqueidentifier.

I have searched the forum and i cant find any solution. i need to use uniqueidentifer data types because replication with PDA devices.

Any tips?

Thank you in advance.
Helder

View 5 Replies View Related

Uniqueidentifier As A Primary Key

Feb 18, 2006

Hey can you use the Uniqueidentifier as a primary key or no??

View 4 Replies View Related

Problem With Sp And Uniqueidentifier

Jul 12, 2006

Hi,

I use this procedure to add a record to the db (SQL 2005)
i constantly get this error:

Conversion failed when converting from a character string to uniqueidentifier.

This is the sp:

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go

ALTER PROC [dbo].[AddBootloader]

@BootName nvarchar(50),
@Version nvarchar(50),
@CSD nvarchar(50),
@CreatorID uniqueidentifier,
@FilePath nvarchar(150),
@FileSize nvarchar(150)


AS
INSERT INTO dbo.EB_Bootloaders

([Bootname]
,[Version]
,[CSD]
,[FilePath]
,[FileSize]
,[CreatorID])


VALUES

(
@BootName,
@Version,
@CSD,
@CreatorID,
@FilePath,
@FileSize)





And this is the table:

USE [Ebdata]
GO
/****** Object: Table [dbo].[EB_Bootloaders] Script Date: 07/12/2006 10:06:42 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EB_Bootloaders](
[ID] [bigint] IDENTITY(1,3) NOT NULL,
[BootName] [nvarchar](50) COLLATE Latin1_General_CI_AS NULL,
[Version] [nvarchar](50) COLLATE Latin1_General_CI_AS NULL,
[CSD] [nvarchar](50) COLLATE Latin1_General_CI_AS NULL,
[FilePath] [nvarchar](150) COLLATE Latin1_General_CI_AS NULL,
[FileSize] [nvarchar](50) COLLATE Latin1_General_CI_AS NULL,
[CreateDate] [datetime] NULL CONSTRAINT [DF_EB_Bootloaders_CreateDate] DEFAULT (getdate()),
[CreatorID] [uniqueidentifier] NOT NULL,
[UpdateDate] [datetime] NULL,
[UpdateUser] [uniqueidentifier] NULL,
CONSTRAINT [PK_EB_Bootloaders_1] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

GO
USE [Ebdata]
GO
ALTER TABLE [dbo].[EB_Bootloaders] WITH NOCHECK ADD CONSTRAINT [FK_EB_Bootloaders_aspnet_Users] FOREIGN KEY([CreatorID])
REFERENCES [dbo].[aspnet_Users] ([UserId])
NOT FOR REPLICATION
GO
ALTER TABLE [dbo].[EB_Bootloaders] WITH NOCHECK ADD CONSTRAINT [FK_EB_Bootloaders_aspnet_Users1] FOREIGN KEY([UpdateUser])
REFERENCES [dbo].[aspnet_Users] ([UserId])
NOT FOR REPLICATION

The funny thing is that i copied the sp code from another which runs perfect,
I insert a Guid from an asp.net page.

Hope someone can help me here because im am stucked!

Cheers Wimmo

View 3 Replies View Related

How Do I Get The Uniqueidentifier Of Just Inserted Row?

Apr 18, 2004

Hello there!

it was a while since i studied SQL and that brings us to my problem...

I'm creating a Stored Procedure wich first insert information in a table. That table has a uniqueidentifier fild that is default-set to newid().

later in the SP i need that uniqueidentifier value? how do I get it?

I tried this:

CREATE PROCEDURE spInsertNews
@uidArticleId uniqueidentifier = newid,
@strHeader nvarchar(300),
@strAbstract nvarchar(600),
@strText nvarchar(4000),
@dtDate datetime,
@dtDateStart datetime,
@dtDateStop datetime,
@strAuthor nvarchar(200),
@strAuthorEmail nvarchar(200),
@strKeywords nvarchar(400),
@strCategoryName nvarchar(200) = 'nyhet'
AS
INSERT INTO tblArticles
VALUES( @uidArticleId,@strHeader,@strAbstract,@strText,@dt Date,@dtDateStart,@dtDateStop,@strAuthor,@strAutho rEmail,@strKeywords)

declare @uidCategoryId uniqueidentifier
EXEC spGetCategoryId @strCategoryName, @uidCategoryId OUTPUT

INSERT INTO tblArticleCategory(uidArticleId, uidCategoryId)
VALUES(@uidArticleId, @uidCategoryId)


But i get an error when I EXEC the SP like this:

EXEC spInsertNews
@strHeader = 'Detta är den andra nyheten',
@strAbstract = 'dn första insatt med sp:n',
@strText = 'här kommer hela nyhetstexten att stå. Här får det plats 2000 tecken, dvs fler än vad jag orkar skriva nu...',
@dtDate = '2003-01-01',
@dtDateStart = '2003-01-01',
@dtDateStop = '2004-01-01',
@strAuthor = 'David N',
@strAuthorEmail = 'david@davi.com',
@strKeywords = 'nyhet, blajblaj, blaj'


the errormessage is: Syntax error converting from a character string to uniqueidentifier.


does anyone have a sulution to this problem?
Can I use something similar to the @@IDENTITY?
I will be greatful for any ideas...

thanks
/David, Sweden

View 1 Replies View Related

ASPNETDB.MDF-uniqueidentifier

Jan 25, 2006

Hi:
I am using the built in securty database from vs2005
I am trying to write an insert trigger that will add a role each time a user is added but I seem to be having difficulty I believe it's with the uniqueidentifier datatype. when I run this trigger via an insert statement I get the following error.
Can anyone set me straight?
========error==============
Cannot insert the value NULL into column 'RoleId', table 'R:AAAPROJECTSASPVS2005MERCERBUCKSAPP_DATAASPNETDB.MDF.dbo.aspnet_UsersInRoles'; column does not allow nulls. INSERT fails.
==================insert statement==========

Declare @NewUserID as uniqueIdentifier
set @NewUserID=newID()
print Cast(@NewUserID as varchar(50))
insert into dbo.aspnet_Users (ApplicationID,UserID,UserName,LoweredUserName,LastActivityDate)
Values('f23f01f0-7ad7-463b-87e2-f3e9141e6426',@NewUserID,'lrchase','lrchase','7/20/2005')
======trigger============================
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go


ALTER TRIGGER [InsertRole]
ON [dbo].[aspnet_Users]
AFTER INSERT
AS
DECLARE @RoleID uniqueidentifier
DECLARE @UserID uniqueidentifier
Select @UserID=Userid from inserted
Print @UserID
SELECT @RoleID = RoleID
FROM dbo.aspnet_Roles where dbo.aspnet_Roles.LoweredRoleName='user'
Print @RoleID
SET NOCOUNT ON;
Insert Into dbo.aspnet_UsersInRoles
Values(@UserID,@RoleID)

Thanks Len

View 2 Replies View Related

Rowguid/ Uniqueidentifier

Jun 7, 2007

hi. im new in using rowguid, i want to know how long can this datatype can hold. and is there a chance that value can be duplicate or the sql is checking it already before it create a new one.

and what will happen if i select yes in isrowguid.
thnx

View 2 Replies View Related

Select Where Uniqueidentifier = 0x Hex?

Aug 22, 2005

Hi all,I'm trying to run a select where auniqueidentifier/GUID equals a hex, but I don't seem to be gettingmatches.For example, this query returns the expected record:select * from items where itemGUID ='{11111111-2222-3333-4444-555555555555}'But this one does not:select * from items where itemGUID = 0x11111111222233334444555555555555Any tips?thanks, -Scott

View 5 Replies View Related

Uniqueidentifier Vs. Identity

Jul 26, 2007

So, what's the common preference out there for primary and/or surrogate keys? Uniqueidentifier or identity?
(No replication is involved.)

View 7 Replies View Related

UniqueIdentifier As Primary Key.

Jan 17, 2008

SQL2K SP4

Greetings. I just inherited doscovered a 3gb DB that is chewing up lots of CPU time on a pretty beefy server. This DB uses 4 main tables. It has many more, but most of the Inserts/ Updates/ Deletes/ and Joins are done mainly on 4 tables. Anyways, I figured out which sprocs use the most CPU between the hours of 7 and 7 every day, off to a good start. The first one is hardly every run. While it is a pig in terms of CPU usage, the amount of times it's run is somewhat minimal compared to others. So the next one is is a sproc that does auto refreshes, and is run every minute by thousands. I start to analyze it, particularly for missing indexes, but all is well. So I'm beating my head up against the wall and I realize, THE CLUSTERED PRIMARY KEY (PK) FOR THESE TABLES USE A GUID DATA TYPE....

So I have some questions about this data type, and also inserting into a clustered PK in general.



Are joins on this data type as bad as joining on varchar columns in terms of speed?

I don't see that any of my insert sprocs are taking a long time. So if an insert occurs, and a page split needs to happen (which is quite potential with this data type as a clustered PK), does it -- A) Begin the insert, complete the insert, then do a page split? Or does it -- B) Begin the insert, do the page split, then complete the insert?
If A, it would make sense that I would see no lag for my insert sprocs, but also see a high CPU usage (provided I have a high number of page splits, which is yet to be determined. If B, I would expect to see a lot of long running insert sprocs, which I don't.

View 10 Replies View Related

How Do I Convert A Uniqueidentifier, Given The Value.

Sep 13, 2006

convert(uniqueidentifier, 00000000-0000-0000-0000-000000000000)

not working.

View 3 Replies View Related

Using Uniqueidentifier Datatype

Sep 26, 2007

Hai,


Because uniqueidetifier is not an auto generated field, How can be it used with a primary key column ?

Thanks

Maju

View 5 Replies View Related

Converting To A Uniqueidentifier

Apr 26, 2006

Hi all

In the database there is a table for customers and a table for the saleman,
the relationship between the 2 table is a uniqueidentifer field

customer table
name salesmanager
company 1 12545-854

salesmanager table
id salesmanager
12545-854 bob smith

I need to update the customer salesmanger field when someone leaves problem is that that field
is a uniqueidentifer and it will not allow me to update


Thanks in advance
rich

View 2 Replies View Related

Uniqueidentifier Question

Feb 21, 2008



I have a table that contains a uniqueidentifier column and then another table that contains a foreign-key column, but is set up as varchar. I am building a stored procedure, however I get the following error: "Syntax error converting from a character string to uniqueidentifier"

I tried casting the UID column to a varchar, but this does not work either.

This is a simple select where the column in the foreign table is equal to the ID column of the main table.

Is there a way to solve this without having to make any table changes?

Thanks for the help.

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved