473,800 Members | 2,499 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Converting Guids, and using parameterized stored procedures

dew
I have a stored procedure that retrieves the id of a client table, which is
a guid

To get that id, I have
dim clientid as guid = GetClientID("Or gName")

The GetClientID returns a string, because sometimes it's not a guid, but in
this procedure it is.
How do I convert the GetClientID into a Guid? I tried

dim clientid as guid = CType(GetClient ID("OrgName"), guid)

but I get an error that says it cannot convert a string into a guid. I even
tried manually inserting a known guid in place of the GetClientID function
and still get the same error.

I tried changing the function GetClientID to return an object, and I get the
same conversion error.

On the other hand, I cannot change ClientID to a string, because then my
stored procedure will not work. My parameter is :
param=cmd.param eters.add("@Wor kerID", sqldbtype.uniqu eidentifier, 255)

I cannot change the parameter because the stored procedure will not work, if
I change the stored procedure to be a uniqueidentifie r, I get an error that
says Syntax .... converting string to a uniqueidentifie r.

So what am I missing: I need to retrieve a uniqueidentifie r (the client
id), so I can update other records using that clientid and I just don't seem
to have all the ducks in a row.

Thanks for your help.


Feb 8 '06 #1
3 4438
this is how I do it in c#:

execProc.Parame ters.Add("@id", SqlDbType.Uniqu eIdentifier).Va lue = new
Guid(myString);

Hope that helps;
Alex.
"dew" <de*@yahoo.co m> wrote in message
news:OV******** *****@TK2MSFTNG P09.phx.gbl...
I have a stored procedure that retrieves the id of a client table, which is
a guid

To get that id, I have
dim clientid as guid = GetClientID("Or gName")

The GetClientID returns a string, because sometimes it's not a guid, but
in
this procedure it is.
How do I convert the GetClientID into a Guid? I tried

dim clientid as guid = CType(GetClient ID("OrgName"), guid)

but I get an error that says it cannot convert a string into a guid. I
even
tried manually inserting a known guid in place of the GetClientID function
and still get the same error.

I tried changing the function GetClientID to return an object, and I get
the
same conversion error.

On the other hand, I cannot change ClientID to a string, because then my
stored procedure will not work. My parameter is :
param=cmd.param eters.add("@Wor kerID", sqldbtype.uniqu eidentifier, 255)

I cannot change the parameter because the stored procedure will not work,
if
I change the stored procedure to be a uniqueidentifie r, I get an error
that
says Syntax .... converting string to a uniqueidentifie r.

So what am I missing: I need to retrieve a uniqueidentifie r (the client
id), so I can update other records using that clientid and I just don't
seem
to have all the ducks in a row.

Thanks for your help.

Feb 8 '06 #2
dew
You are Good! Thanks very much, that worked beautifully.

"dew" <de*@yahoo.co m> wrote in message
news:OV******** *****@TK2MSFTNG P09.phx.gbl...
I have a stored procedure that retrieves the id of a client table, which is
a guid

To get that id, I have
dim clientid as guid = GetClientID("Or gName")

The GetClientID returns a string, because sometimes it's not a guid, but
in
this procedure it is.
How do I convert the GetClientID into a Guid? I tried

dim clientid as guid = CType(GetClient ID("OrgName"), guid)

but I get an error that says it cannot convert a string into a guid. I
even
tried manually inserting a known guid in place of the GetClientID function
and still get the same error.

I tried changing the function GetClientID to return an object, and I get
the
same conversion error.

On the other hand, I cannot change ClientID to a string, because then my
stored procedure will not work. My parameter is :
param=cmd.param eters.add("@Wor kerID", sqldbtype.uniqu eidentifier, 255)

I cannot change the parameter because the stored procedure will not work,
if
I change the stored procedure to be a uniqueidentifie r, I get an error
that
says Syntax .... converting string to a uniqueidentifie r.

So what am I missing: I need to retrieve a uniqueidentifie r (the client
id), so I can update other records using that clientid and I just don't
seem
to have all the ducks in a row.

Thanks for your help.

Feb 9 '06 #3
you are welcome!
alex.
"dew" <de*@yahoo.co m> wrote in message
news:%2******** *******@TK2MSFT NGP10.phx.gbl.. .
You are Good! Thanks very much, that worked beautifully.

"dew" <de*@yahoo.co m> wrote in message
news:OV******** *****@TK2MSFTNG P09.phx.gbl...
I have a stored procedure that retrieves the id of a client table, which
is
a guid

To get that id, I have
dim clientid as guid = GetClientID("Or gName")

The GetClientID returns a string, because sometimes it's not a guid, but
in
this procedure it is.
How do I convert the GetClientID into a Guid? I tried

dim clientid as guid = CType(GetClient ID("OrgName"), guid)

but I get an error that says it cannot convert a string into a guid. I
even
tried manually inserting a known guid in place of the GetClientID
function
and still get the same error.

I tried changing the function GetClientID to return an object, and I get
the
same conversion error.

On the other hand, I cannot change ClientID to a string, because then my
stored procedure will not work. My parameter is :
param=cmd.param eters.add("@Wor kerID", sqldbtype.uniqu eidentifier, 255)

I cannot change the parameter because the stored procedure will not work,
if
I change the stored procedure to be a uniqueidentifie r, I get an error
that
says Syntax .... converting string to a uniqueidentifie r.

So what am I missing: I need to retrieve a uniqueidentifie r (the client
id), so I can update other records using that clientid and I just don't
seem
to have all the ducks in a row.

Thanks for your help.


Feb 9 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
4672
by: Bill | last post by:
I have a catalog of books which need to be categorized into different groups. Some of the books can be listed under more than one category. I'm creating a page where I can assign a group of books to a category by checking the checkbox next to their name (say I've looped out 100 of them, and check some, and not others) then submitting the form for processing, so that those titles where the checkbox is checked will get the categoryid number...
2
7325
by: Yves Touze | last post by:
Hi All, I'm trying to migrate from SQL Server 7.0 to SQL Server 2000. I've got some ASP page which call VB components that retrieve shaped recordsets from SQL Server using the MSDATASHAPE provider. Precisely, here is the code i have Dim Cmdobj As New ADODB.Command Cmdobj.ActiveConnection = oconn Cmdobj.CommandType = adCmdStoredProc
0
6706
by: Nashat Wanly | last post by:
HOW TO: Call a Parameterized Stored Procedure by Using ADO.NET and Visual C# .NET View products that this article applies to. This article was previously published under Q310070 For a Microsoft Visual Basic .NET version of this article, see 308049. For a Microsoft Visual C++ .NET version of this article, see 310071. For a Microsoft Visual J# .NET version of this article, see 320627. This article refers to the following Microsoft .NET...
18
10328
by: Robin Lawrie | last post by:
Hi again, another problem! I've moved from an Access database to SQL server and am now having trouble inserting dates and times into seperate fields. I'm using ASP and the code below to get the date and time, but my script is erroring. '-- Get login date and time cmdLoginDate = Date() cmdLoginTime = Time()
2
9247
by: Kent Lewandowski | last post by:
hi all, Recently I wrote some stored procedures using java jdbc code (admittedly my first stab) and then tried to implement the same within java packages (for code reuse). I encountered problems doing this. I wanted to implemented a generic "Helper" class like this: /** * Helper
2
3981
by: Not Me | last post by:
Hey, Coming back to a piece of work I did a while back, which used a stored procedure to populate a list box. The SP takes a single parameter, and I think this is the reasoning for using 'exec' in the row source (I assume you need this for parameters?) The problem is this only works when I access the form.. If I do it from someone else's computer they get a blank listbox. They have appropriate permissions for the stored procedure,...
1
10980
by: vector | last post by:
I've got an application that generates GUIDs. A lot of GUIDs. Lots of GUIDs that end up in files on disk, taking up space. I'd like to continue using the Guid.NewGuid() function as my unique tag generator, but I'd also like to compress them to base 36 strings, which should retain their uniqueness but save me disk space. I've looked at various base conversion functions, and haven't found a suitable one. Further, I don't need an AnyBase...
0
855
by: mac | last post by:
I have program that modifies data from several different databases, and includes many many tables and columns. I have created stored procedures for all the updates, but how do I automate the parameters so that I don't have to write out 150 column names and their datatypes by hand? Right now all the values are in arrays or dataset, or other collective list, so I can easily create the stored procedure syntax with just the values, but to...
4
5747
by: --CELKO-- | last post by:
I need to convert a bunch of DB2 triggers to Oracle. Is there any kind of tools for this?
0
9690
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9551
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10274
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10251
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9085
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7576
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6811
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.