.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

How to show random information with C# from a SQL Database?

Posted By:      Posted Date: September 02, 2010    Points: 0   Category :ASP.Net
I have to do the following in my web page.  Any advice and how to do this please with C# I have a table where I have a column for different states (NY, NJ, etc).  People can join the group (in my page) for each state (the state where they live).  So I have to display the newest members for each state. So the way it should work is, every time the page is refreshed/reloaded it should show the state name as a header text and the first 5 newest members for that state.  This should be random, for example initially when the page is loaded say it will show state: New York and the 5 recent members like Stacy, Laura, Mike, Sam, Mathew. Then when the page is refreshed it will show another state like State: california and the recent 5 members All the information comes from the database How should I do this?

View Complete Post

More Related Resource Links

ERROR [HY000] [Informix .NET provider][Informix]Database locale information mismatch


Hi, there is an upgrade to my infimacs server and my web application encounter this error after the infimacs is upgraded.

Below is the information on the server before/after the upgrade.

Before            After

---------       -----------  

Solaris 8      Solaris 10

IDS 9.40     IDS 11.50

The web server where the web application hosted is running IBM Informix Connect 2.81. There is no such error before the upgrade is done.

As a developer, i have IBM Informix Client-SDK 2.90 installed on my local pc and debug the page where the read is needed from infimacs but no such error found.

The error come out only when it is hosted on the web server where IBM Informix Connect 2.81 is installed.

I have gone through many articles and it suggest me to set the environement  variable in the server :  DB_LOCALE=en_us.819.

I haven't try this solution but i think that this might not be the best solution.

Is it possible to to to have this settin

Show web applications build version information



I would like to make the build information for the running web application but I dont know where I set or configure this nor do I know how to retrieve this information.

In a project you may set the  build information in the file AssemblyInfo.cs under the projects Properties folder. Here is a snippet of the AssemblyInfo.cs file:

// Version information for an assembly consists of the following four values:
//      Major Version
//      Minor Version 
//      Build Number
//      Revision
// You can specify all the values or you can default the Revision and Build Numbers 
// by using the '*' as shown below:
[assembly: AssemblyVersion("6.3.0")]
[assembly: AssemblyFileVersion("6.3.0.*")]

But there is no such file for an web application project, so I have to get this information from one of the compiled DLLs that is in the same assembly as my web application then? Or how is this done?


The reason I want this information is because my customer would like to have a webpage within the web application where he could see the current version. This is also nice to have when testing and debugging etc.




Information Worker 2010 - Web applications do not show up

i have Information Worker 2010 VHD running on VMware-MacBookPro with 6Gb ram. I converted vhd to vmware and it runs fine but for watever reason am unable to bring up the various web applications in the VM. I can goto Central Admin but the web applications (each is configured with a host header) simply dont show up.  i googled for hrs and have tried DisableLoopback thread etc., checked dns entries but nothing helps. What am trying is definitely not to be done in a production env, which is running web app on local server. has anyone been able to bring up web apps successfully. 


Hello, I have these tables....   CREATE TABLE test( codeTest int IDENTITY(1,1), name varchar(100) not null, PCK varchar (15) not null, AK varchar (15) not null, testdate datetime not null, CONSTRAINT testPK PRIMARY KEY (codeTest), );   CREATE TABLE subtest( codeSubtest int IDENTITY(1,1), codeTest int not null, name varchar(100) not null, ps1 int not null, ps2 int, ps3 int, ps4 int, ps5 int, maximumpeek char(1), fullsocketsps1initial int, fullsocketsps2initialfull int, fullsocketsps1final int, fullsocketsps2final int, CONSTRAINT subtestPK PRIMARY KEY (codeSubtest), CONSTRAINT subtestFK FOREIGN KEY (codeTest) REFERENCES test (codeTest) on delete cascade, );   CREATE TABLE scheduler( codeScheduler int IDENTITY(1,1), codeSubtest int not null, ps int not null, step varchar(10) not null, task int not null, cycletime real not null, maxdelay bigint not null, maxexecutiontime bigint not null, maxcycletime bigint not null, lostscans bigint not null, inputtimeouts real not null, outputtimeouts real not null, comments varchar (50), CONSTRAINT schedulerPK PRIMARY KEY (codeScheduler), CONSTRAINT schedulerFK FOREIGN KEY (codeSubtest) REFERENCES subtest (codeSubtest) on delete cascade, );   I want to show, the maxcycletime when task=2 for every test: so this I can do it... SELECT    MAX (scheduler.maxexecutiontime) AS [MAX CYCLE TIME]   ,test.codeTest AS

Suppose we are building a web-based application to retrieve and enter information into a database.

Please help me out with thisSuppose we are building a web-based application to retrieve and enter information into a database.  The user-interface invokes web services.  Which architecture  would use for the application.

need information on database backup

Hi, As a developer Ihave very minimal knowledge on database backups. Before reaching out to DBA I want to understand few things 1) I need to place a request to create new database on a SQL Server. There is around 540 GB space on this server but the two existing databases on this server already used 500GB space. So what option do we have to create new database? Is it a simple task to add another drive and allocate some space or use mapped drive? what options can I suggest DBA? 2) Also DBA mentioned that there is no space to take backup on this drive for the existsing database. What option can I suggest for backup incase if we plan to drop one of the database which is not actively used?

Only show text from database if field is not empty

 Hoping someone can help. I am using ASP.NET VB and i am wondering how to only show text from database if data exists. I tried this but it does not work.Any help would be greatly appreciated.I am new to .NET, in the past i have always used classic asp. 1 <td valign="top" style="border-right: 2px solid #031992"> 2 (<%# Eval("VenderPhone1") %>) <%# Eval("VenderPhone2") %>- <%#Eval("VenderPhone3")%> 3 4 <% If String.IsNullOrEmpty(Trim("VenderAlt1").ToString) Then%> 5 <br />(<%#Eval("VenderAlt1")%>) <%# Eval("VenderAlt2") %>- <%#Eval("VenderAlt3")%> 6 <% End If%> 7 <% If String.IsNullOrEmpty(Trim("VenderFax1").ToString) Then%> 8 <br />(<%# Eval("VenderFax1") %>) <%# Eval("VenderFax2") %>- <%#Eval("VenderFax3")%> 9 <% End If%> 10 11 </td> 12   

Newsfeed does not show all types of information


Ok, so I have created two users, and user1 has added user2 as his colleague. User1 has everything checked off under "Activities I am following" in his profile, so intuitively, he should see everything that user2 does.

Logged in as user2, I do the following updates:


  • Create some notes
  • Create some tags
  • Add a picture
  • Add a blog post
  • Update the "says" field
  • Add some details to the pofile, e.g. phone number etc.


I then trigger the "User Profile Service Application - Activity Feed Job" service manually to see the changes.

The only things showing up in user1's newsfeed, are:

  • User2's notes
  • User2's "says" field
  • User2's profile details, e.g. phone number
The rest is mysteriously not showing. If I browse to user2's profile page, I can see his picture and blog posts under "Content", so the permissions are not the issue there. Under "Tags and notes", I see only notes, which may indicate a permission issue. However, the tags are not marked as private by user2.

We experience the same behaviour both on a release candidate installation and on the rtm version. I have tried to

How to retrive client name ,Field , and Image from Database and show in datalist?


hi experts,

i wanat to display Client Name, Field and  image in datalist. Stored Procedure like this

ALTER proc [dbo].[get_clients_services]
SELECT     Clients.ClientName AS Client, Fields.FieldName AS Field, ServiceType.ServiceType AS Services, ServiceType.Servicelink AS Link, 
                      Clients.ClientLogo AS Logo
FROM         Clients INNER JOIN

C# Database created but does not show up in Server Management Studio unless I manually attach it.


I used C# Linq to Sql to create a database. I look on the hard drive and the database .mdf and .ldf files are there. I open Server Management Studio 2008, attach to SQL express and the database is not there unless I actually attach the database.


First, is this correct behavior?

Second, is it possible to create a Sql Express database that is automatically registered(?) in Management Studio? If so, please give pointer.


Thanks very much.



Retrieving information from database


Hi, I have an aspx form that is meant to add a new prescription for a doctor system. I've created the database and dataset needed, but the problem is that the doctorID and patientID has to be able to select from the database, not entered in as a plain text. The form look something like this (I did this in DetailsView in MS Visual Studio 2010):

DoctorID:  [textbox]

PatientID: [textbox]

prescription details: [textbox]

Insert   Cancel

as you can see, only the prescription details needed to be entered in and the doctorID and patientID needed to be selected from the database (in a dropdown list maybe) and it shouldnt allow any text to be entered in. I did the above tables using a DetailsView in Microsoft Visual Studio 2010. However I can't seem to make the doctor and patient ID field be dropdown box which allow me to choose the current doctor and patient in the Doctor and Patient table in the databse.  Can anyone tell me how to do it with Design View in Visual Studio? Cause the source view is kinda confusing for me. 

Thanks in advance!

show image in gridview from sql database


how to show image in gridview from sql database

How to show readonly values in textbox from database?


I have 4 textboxes. On which I want to show values from a database table which are readonly. After a button click event I have to show the updated values again.Two difficulties I have faced 1st to get four fields of data from DB than show those four data in specific texboxes.another is after doing some calculation showing updated data after a button click event. Can anyone give me a solution?

Restoring a content database from another server/AD does not synch user profile information for new


In my SharePoint 2010 beta environment, I have user profiles synching with Active Directory.  I just restored a content database from a separate environment/domain and logged in with my current account.  When I try to create an alert on a library/item, I get the error:

“You do not have an e-mail address.  Alert has been created successfully but you will not receive notifications until valid e-mail or mobile address has been provided in your profile.”

I went to My Profile and found that the My Profile had the right e-mail address (I guess because this is on my My Site Host).

But when I went to My Settings, it did not have any e-mail address for me (I guess this is because it is at the WSS content database level and the e-mail address hasn’t yet synched from the user profile database).

Does anyone the timer job that synchs the user profile with the My Settings for a site collection in a content database?

Issue is posted to my blog with screenshots here:



Unable to connect to database. Check database connection information and make sure the database ser



I am using MOSS2007. My MOSS site was working fine for last 1 month and today suddenly it started to show me below message

"Unable to connect to database.  Check database connection information and make sure the database server is running."


On my server, SahrePoint admin site is working. Other port site is also working. Only my MOSS site is showing me above message.  Can anyone helkp me to resolve this issue.

Need information about Connecting to different database form with in a package


We have a UniVerse data base to connect. How to connect to universe database from within ssis package(which connection manager is to be used)?

Access report server database connection information from custom security extension



Is there any way from my custom security extension that I can get to and unencrypt the database connection information held within the RSReportServer.config file?



ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend