tehon3299 Posted February 7, 2003 Posted February 7, 2003 Hey - I am trying to create a GUID in VB.NET. What is the code for this? Is it Dim newGUID as New GUID() Also, how can I insert this value into an SQL table? Thanks Quote Thanks, Tehon
*Experts* Nerseus Posted February 7, 2003 *Experts* Posted February 7, 2003 Do you need the GUID client side or can you let SQL Server create it? I think it's something like this (might be off and I don't have SQL server here): DECLARE @GUID AS uniqueidentifier SELECT @GUID = new GUID I don't know how to get one in VB.NET... -nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
tehon3299 Posted February 7, 2003 Author Posted February 7, 2003 This is being created on an aspx page and then I am inserting it into an SQL Table. Quote Thanks, Tehon
*Experts* Nerseus Posted February 7, 2003 *Experts* Posted February 7, 2003 Do you HAVE to have it on the ASPX page? Normally it's a good idea to let SQL Server create the GUID if you're talking about inserting into a uniqueidentifier column. I've had to create them in VB6 because I needed the GUID to insert into multiple, joined tables. If you just need a GUID for another reason and want to insert it into a table just for storage, then someone else will have to help. -nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
tehon3299 Posted February 7, 2003 Author Posted February 7, 2003 What I need to do is: -Create the GUID -Insert it into an SQL table -Create an SQL table and name it with the GUID So this mean that I would need to create it on the ASPX page, right?? Thanks Quote Thanks, Tehon
Leaders quwiltw Posted February 7, 2003 Leaders Posted February 7, 2003 What I need to do is: -Create an SQL table and name it with the GUID I was tracking with you til you said this. If you're saying what I think you're saying this is *really* strange. Either way it's: System.Guid.NewGuid As in: Dim g As Guid g = System.Guid.NewGuid Quote --tim
tehon3299 Posted February 7, 2003 Author Posted February 7, 2003 Why is this *really* wierd? I want to be able to have user be able to create an account and have an individual table for each user. So when they create their account, they have a GUID associated with their Username and Password. Then I can load their table after they log in. Quote Thanks, Tehon
Leaders quwiltw Posted February 7, 2003 Leaders Posted February 7, 2003 it's strange (and very wrong IMO) to create a whole new database table with identical data models on the fly for every user. ideally, your data model would not change once it's stable. i know of no dba that would let me assume this in my software design. why not just create a tblAccounts that is in a one-to-many relationship with tblAccountDetails? That'd be a fairly standard approach to what it sounds like you're doing. Quote --tim
tehon3299 Posted February 7, 2003 Author Posted February 7, 2003 Well thank you for letting me know this. I am not aware of all the particulars when programming since I am a 19 year old college student just trying to learn Visual Basic and the .NET platform. Thanks Quote Thanks, Tehon
Leaders quwiltw Posted February 7, 2003 Leaders Posted February 7, 2003 fair enough. if you're interested post up a description of your problem and I'm sure folks here can help with a good database design that doesn't include dynamic creation of tables. Quote --tim
tehon3299 Posted February 7, 2003 Author Posted February 7, 2003 OK...Here's the idea. I need to have many people access this web application with different usernames and passwords. Each person is going to have specific data in their table. How would I go about designing this?? Quote Thanks, Tehon
Leaders quwiltw Posted February 7, 2003 Leaders Posted February 7, 2003 I'd want to know more about the data but generally... create table tblUsers ( userID int, userName varchar(50), password varchar(24) ) create table tblUserData ( id int, userID int, someData varchar(200), someData2 varchar(200), someData3 varchar(200), etc... (200), ) to get data out for a particular user, use something like SELECT * FROM tblUserData JOIN tblUsers on tblUsers.userID=tblUserData.userID where userName='quwiltw' or, more likely you'll maintain the foreign key userID and will never actually need the join. Obviously, I've had to make a number of assumptions in my answer but hopefully it'll get you on a better path. Quote --tim
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.