usingtruncate tablewill help you.
thanks,
satish.
sqlusingtruncate tablewill help you.
thanks,
satish.
sqlHi all,
In my VB 2005 Express, I created a Windowds Form application "shcDataSet" that used 1 SqlConnection, 1 SqlDataSet and 3 SqlDataAdapters associated with the Northwind Database in my SQL Server Management Studio Express. The SqlConnection had "User Instance" in the following ConnectionString: Data Source=.\SQLEXPRESS;AttachDbFilename="C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\northwnd.mdf";Integrated Security=True;Connect Timeout=30;User Instance=True. The 3 SqlDataAdapters were for the Northwind files "Customers", "Orders" and "Order Details" used in the SQLDataSet "AllOrders" with a AllOrders.xsd file. I ran the "shcDataSet" applicatyion and it worked fine. After the execution of "shcDataSet", I checked the Northwind database in my SQL Server Management Studio Express and clicked on "+" in front of Northwind database-I did not see any file showed up and I got the following error message: Failed to retrieve data for this request. (Microsoft.SqlServer.Express.SmoEnum) Additional information: one or more files do not match the primary file of the database. If you are attempting to attach a database, retry the operation with the correct files. If this is an existing database, the file may be corrupted and should be restored from a backup. (Microsoft SQL Server, Error:5173). If I executed the "shcDataSet" application again, I got a new error: SqlException was unhandled - Cannot open user default database. Login failed. Login failed for user 'myPC##\myName' ->daCustomers.Fill(AllOrders11, "Customers"). I have 3 questions to ask: (1) How can I re-install the Northwind database in SQL Server Management Studio Express? (2) When I use the .Fill Method, do I have to tell the SQL Server Management Studio Express to load and/or unload the Northwind files "Customers", "Orders" and "Order Details"? (3) After I executed the "shcDataSet", should I Upload the 3 Northwind files back to the SQL Server Management Studio Express? Please help and advise. Thanks, Scott Chang
this is a very common problem in SQL Server Express user intance. YOu are using user instance feature of SQL Server 2005 Express. If you are not intended to do it.. then change the connection string.
Refer this blog :
http://blogs.msdn.com/sqlexpress/archive/2006/11/22/connecting-to-sql-express-user-instances-in-management-studio.aspx
Madhu
|||Hi Madhu, Thanks for your response.
I am new in using the "User Instance" in SQL Server Express and VB 2005 Express. This is the first time I tried to learn it by copying the example from a book. I plan to apply the same technique to my own chemical database and applications for my data management. I do not understand what you said by "If you are not intended to do it.. then change the connection string". Please be specific and give me more details about your statement.
I read the blogs you mentioned and the MS Technical Articles "SQL Server 2005 Express Edition User Instances", "How to: Move Through a DataSet with the Windows Forms BindingNavigator Control", "Connecting to Data with Server Express/Database Express". etc. and I still do not get what you said and the User-Instances Connection, SSEUtil, instance_pipe_name, etc. Please answer my 3 questions stated in my last post in the easy terms for me.
Thanks,
Scott Chang
|||Hi Madhu, Thanks for your response.
I am new in using "User Instance" and I do not understand what you meant by "If you are not intended to do it, then change the connection string". I want to use it and I just want to see what happened and whether the Northwind Database is in SQL Server Management Studio Express or not. This is the first time I learned the User Instance by doing the example of using User Instance example from a book. I plan to apply the User Instance tecjnique to my chemical database and data management applications in VB 2005 Express-ADO.NET 2.0 programming. If I loose my chemical database during the application of User Instance, it is not possible for me to retrieve the chemical database. I read the blogs you cited and the MS technical articles "SQL Server 2005 Express Edition User Instances", "Connecting to Data with Server Explorer/Database Explorer", "How to: Install and Troubleshoot Database Components for Samples", etc. I do not understand why SSEUtil and Instance_Pipe_Name are used in the connecting to User Instances. Please clarify what you meant by "If you are not intended to do it, then change the connection string" and answer my 3 questions in a easy-to-undersatnd way for me.
Thanks,
Scott Chang
|||normally, Userinstance of sql server is used unknowingly. that is what i mentioned in my previous post. if you really want to use userinstance of sql server express ... then its ok.... This feature is only available in SQL Server Expess. This one kind of embeded datbase with your application. Handling of Normal and user instance database are totally different. Its already mentioned in above mentioned link. My question is, do you need to use this feature in your application ... this will ofcouse increase the managebility of your Visual studio application (no need to create the database explicitly when you distribute the application) but it has lot of limitations also
Madhu
|||Hi Madhu,
I am lost completely now and do not want to do the User Instance any more - I just want to repair/restore the Northwind Database in my SQL Server Management Studio Express now. This morning, I downloaded the Northwind and Pubs Sample Databases from http://www.microsoft.com/downloads/details.aspx?FamilyID=06616212-0356-46a0-8da2-eebc53a68034&DisplayLang=en/ and saved SQL200SampleDb.msi in my PC. I double-clicked the SQL2000SampleDb.msi file to install the Northwind database - it ran, but the Northwind database in my SQL Server Management Studio Express had no files to show, when I clicked the '+' in front of the Northwind node!!!? What is wrong in my PC? Do I have to delete the User Instance=True of the Connection String of my "shcDataSet" project when executed? Please help me in restoring/repairing the Northwind Database in my SQL Server Management Studio Express?
Many Thanks,
Scott Chang
|||post the connection string... if you don't want user instance.. yes you need to change the connection string...
For Connection string Refer : http://www.connectionstrings.com/?carrier=sqlserver2005
And also ... sql server 2005 sample datbase is Adventureworks... Northwind still you can use , but many new features like schema and all will not be available in that. you can download Adventureworks database from the link mentioned below
http://www.microsoft.com/downloads/details.aspx?familyid=e719ecf7-9f46-4312-af89-6ad8702e4e6e&displaylang=en
Madhu
|||Hi Madhu, Thanks for your response.
1) I went to the CANtrol Panel => Add or Remove Program => removed the old Microsoft SQL Server 2005 Samples. Then I downloaded the new Microsoft SQL Server 2005 Samples from
http://www.microsoft.com/downloads/details.aspx?familyid=e719ecf7-9f46-4312-af89-6ad8702e4e6e&displaylang=en (as you said).
I checked the SQL Server Management Studio Express and looked at the Northwind Database and I still did not see any files in the Northwind Database!!!? Please tell me how I bring the files of Northwind Database to the SQL Server Management Studio Express (i. e. how to repair it.).
2) I do not understand whay you mean by "if you don't want user instance.. yes you need to change the connection string...
For Connection string Refer : http://www.connectionstrings.com/?carrier=sqlserver2005". Please elaborate this matter if you can. Pardon me for asking this thing.
Thanks again,
Scott Chang
Here is what I have and (somewhat understand). I'm using Visual WebDeveloper 2005 Express Edition and have setup my application to use form authentication(which automatically creates the ASPNETDB.MDF file with several default tablesand views). I'm using the CreateUserWizardwhich is fine…but I need to collect additional information like (firstname,lastname, address…and on..). What I'vedone. I've created a tabled namedUserProfile and set UserId as the primary key (uniqueidentifier). I then setup a 1-to-1 relationshipbetween aspnet_Users and UserProfile (which I think is correct). On my UpdateContactInfo.aspx page (whereusers go to update their personal information) I use a hidden label control(UserValue) to receive the UserId during the page_load event as below:
UserValue.Text = Membership.GetUser().ProviderUserKey().ToString()
End Sub
Then you can use a SqlCommand to issue the insert command to the UserProfile anywhere you like in your code:
using (SqlConnection conn= new SqlConnection(@."Data Source=(local);Integrated Security=SSPI;Database=mydb;");
{
connection.Open();
SqlCommand cmd = new SqlCommand("insert into UserProfile select @.UserId, @.firstname, @.lastname, @.address", conn);
cmd.Parameters.Add("@.UserId", SqlDbType.UniqueIdentifier);
cmd.Parameters["@.UserID"] = UserValue.Text;
//add all parameters and set their values
cmd.ExecuteNonQuery();
conn.Close();
}
|||
Why aren't you using the built-in profile system?
Why are you setting a hidden form field (Which can be spoofed) to store the userid, instead of a session variable or just looking it up when you want to do the update?
|||How do I go about retrieving the current user's [UserId] information from the session variable? And what is stored inside the session variable by default. Also... I've done some reading on the built-in profile system and have walked through the [ASP.NET HOW DO I Video Series: Profiles and Themes ] . My next question is...what if I wanted to store items in my profile that is not of type: string. So far all the property values that have been stored in the profiles table are all storing as type: string. I would like to store some of these properties as an integer type.|||
The profile can store anything that can be automaticlly converted to and from a string (That includes datetime, integer, float, decimal, and a lot of other obejcts).
You can retrieve the state of the session variable in a sqldatasource by selecting the parameter as type "Session" and the sessionkey of whatever you used.
In code after authentication, for example, put this code:
Session("UserID")=membership.getuser().whatever (Sorry, I forget the exact syntax)
Then in sqldatasource, the parameter type is session, with the key being "UserID".
|||Thanks for all the help! I'm now using the profile to store user information (firstname, lastname, age, address...). However I think I've ran into another problem :( Becuase the profile date is stored in a serialized format blob... I cant easily query the database and perform common sql routines. I would like to display all users and their profile data within a gridview but can't figure how to do that. I've read the TableProfileProvider how-tohttp://www.asp.net/sandbox/samp_profiles.aspx?tabindex=0&tabid=1 but the source code is not in VB.NET. Can someone advise... thanks.|||
I had to write my own T-SQL function to pull out profile properties from the blobified format. Not elegant, and definately not fast. You would probably be better off pulling back usernames in a dataset, then calling the membership object to pull the properties and appending them to the dataset, then binding that to the datagrid.
I wish I had time to finish my profile provider. Unfortunately, I've been to busy to go back to revist it since my deblobify function works ok for what I needed at the time. If you want to use the TableProfileProvider, you should be able to compile it into a dll, then reference it from within your VB.NET web application just fine. But I haven't tried it, as I usually just convert stuff from C# to VB myself, and leave it as source in the project.
1. When I open the report using Seagate crystal report for rational /
32 bit crystal Report Designer there are three columns which are going
out side the visible area and I am not able to scroll up to them. I
increased the page margin (left / right) and made it to zero and zero
but still I am not able to see those columns. Please guide.
2. Please suggest any good web site for learning Crystal Report 7
Thanks n Regards
Deepak Sinhamicrosoft . public . sqlserver wrote:
Quote:
Originally Posted by
1. When I open the report using Seagate crystal report for rational /
32 bit crystal Report Designer there are three columns which are going
out side the visible area and I am not able to scroll up to them. I
increased the page margin (left / right) and made it to zero and zero
but still I am not able to see those columns. Please guide.
Quote:
Originally Posted by
I am a Web developer. I am new to VB 6.0 and Crystal Report. I have
joined an organisation where there is an application running(developed
in VB6 and crystal report 7). I have to modify one report. In two
columns I have to make minor changes i.e put and = operator. I am
encountering following problem:
>
1. When I open the report using Seagate crystal report for rational /
32 bit crystal Report Designer there are three columns which are going
out side the visible area and I am not able to scroll up to them. I
increased the page margin (left / right) and made it to zero and zero
but still I am not able to see those columns. Please guide.
2. Please suggest any good web site for learning Crystal Report 7
--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx
If the voucherno must be unique, then you should put a primary key or unique
constraint on that column, so that it's impossible to have duplicates. If
the voucherno is generated on the client, then you would have to handle the
error raised when a duplicate is inserted (such as error 2627 for primary
key violation), generate a new number, and submit it again.
Alternatively, you could generate the voucherno in the database. If you just
need an integer value, then you can use the IDENTITY property to generate
the number for you - see "IDENTITY (Property)" in Books Online. Every time
you insert a new row, MSSQL will generate a new number for you - this avoids
writing any code to generate new numbers.
Regarding books, you might find some useful information about SQL books
here:
http://vyaskn.tripod.com/sqlbooks.htm
Someone else may be able to suggest a good VB/SQL book, or you might want to
post in a VB group.
Simon|||Dear Avanish... sorry I cannot help you in dat... while I m just wanna
post a msg here... BYE
hi all iam working on a ticketing application i want to avoid two users to book the same ticket the requirement is as follows
1. the system should show all the available tickets which is not yet booked
2.when two users book the ticket at the same time time it should not allow the two persons to update at the same tme
the main aim is to avoid data concurency
how can i get this done
Use a flag or the best is to use time-stamps?
|||Hi,
From your description, it seems that your problem is related to SQL concurrency issue.
Suppose each ticket is saved in your data table. For your first requirement, it can be achieved by using a flag which indicates if the ticket has been booked or not.
For your second requirement, since ADO.NET uses Optimistic Concurrency. Then locks are set and held only while the database is being accessed. The locks prevent other users from attempting to update records at the same instant. The data is always available except for the exact moment that an update is taking place.
In Optimistic Concurrency, there are two general ways to determine if changes have occurred: the version approach (true version numbers or date-time stamps) and the saving all values approach.
i.e. For Version Number approach, the record to be updated must have a column that contains a date-time stamp or version number. The date-time stamp or a version number is saved on the client when the record is read. This value is then made part of the update.
For more information, seehttp://msdn2.microsoft.com/en-us/library/cs6hb8k4(VS.71).aspx
Thanks!
Hi,
i have developed an web-enabled student database application, where in i'll put all the details of the students from different universities.
while uploading the details of the students, i wanna just import the data given by the universities into the server.
I dont know how exactly the same could be done, also, since each university might be having there own format for the data, how can i import these into singe database?
Any ideas ... Please.
Thanks in advance
----------
CREATE TRIGGER Update_Last_Modified ON [dbo].[MYTABLENAME]
FOR UPDATE, INSERT
AS
BEGIN
SET NOCOUNT ON
DBCC TRACEON (2861)
DECLARE @.Qry nvarchar(4000)
DECLARE @.handle binary(20)
SELECT @.handle = sql_handle
FROM master..sysprocesses
WHERE spid = @.@.SPID
SET @.QRY = (SELECT CONVERT(nvarchar(4000), [text]) FROM
::fn_get_sql(@.handle))
UPDATE MYTABLENAME
SET DATE_LAST_MODIFIED = GETDATE(),
LAST_COMMAND = @.QRY,
LAST_USER = SYSTEM_USER
FROM inserted
WHERE MYTABLENAME.UID= Inserted.UID
END
-----------
It was previously coded to use DBCC INPUTBUFFER, and it worked fine,
but I was limited to the first 255 characters of the command, which
prevented me from seeing the critical parts, like the where clause!
When I modified the trigger to use fn_get_sql, all I ever see is the
entire text of the create trigger command. Maybe I should use an
entirely different approach. I'm open to ideas.
Thanks very much in advance for your help!
Miles
_________________Miles (milesfeinberg@.hotmail.com) writes:
> It was previously coded to use DBCC INPUTBUFFER, and it worked fine,
> but I was limited to the first 255 characters of the command, which
> prevented me from seeing the critical parts, like the where clause!
> When I modified the trigger to use fn_get_sql, all I ever see is the
> entire text of the create trigger command. Maybe I should use an
> entirely different approach. I'm open to ideas.
Yes, the idea with fn_get_sql is to get the currently executing statement
of a procedure. And for a process that introspects itself, the current
statement will be the statement it queries sysprocesses. So in your
case DBCC INPUTBUFFER is a better bet.
--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp