Click here to Skip to main content
15,917,731 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: asp.net 4 with sql server 2008 Pin
lillain2198-Oct-12 9:10
lillain2198-Oct-12 9:10 
AnswerRe: asp.net 4 with sql server 2008 Pin
Vasudevan Deepak Kumar9-Oct-12 7:18
Vasudevan Deepak Kumar9-Oct-12 7:18 
GeneralRe: asp.net 4 with sql server 2008 Pin
lillain2199-Oct-12 21:47
lillain2199-Oct-12 21:47 
Questiongridview rowupdating in ascx file Pin
jhyn7-Oct-12 20:13
jhyn7-Oct-12 20:13 
AnswerRe: gridview rowupdating in ascx file Pin
Sarvesh Kushwaha8-Oct-12 5:23
Sarvesh Kushwaha8-Oct-12 5:23 
Question'System.Web.HttpUnhandledException' Error Pin
rattlesnake3167-Oct-12 17:55
rattlesnake3167-Oct-12 17:55 
AnswerRe: 'System.Web.HttpUnhandledException' Error Pin
Eddy Vluggen8-Oct-12 0:50
professionalEddy Vluggen8-Oct-12 0:50 
AnswerRe: 'System.Web.HttpUnhandledException' Error Pin
Joshua Omundson9-Oct-12 6:50
Joshua Omundson9-Oct-12 6:50 
QuestionIntegrate SharpWebMail in existing project Pin
Soni19856-Oct-12 8:44
Soni19856-Oct-12 8:44 
QuestionThe 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine. Pin
Ali Al Omairi(Abu AlHassan)6-Oct-12 5:38
professionalAli Al Omairi(Abu AlHassan)6-Oct-12 5:38 
AnswerRe: The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine. Pin
Thomas Daniels6-Oct-12 7:00
mentorThomas Daniels6-Oct-12 7:00 
GeneralAccess Database Engine 2010 Redistributable is not intended Pin
David Mujica8-Oct-12 2:56
David Mujica8-Oct-12 2:56 
GeneralRe: Access Database Engine 2010 Redistributable is not intended Pin
n.podbielski9-Oct-12 0:28
n.podbielski9-Oct-12 0:28 
AnswerRe: The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine. Pin
Murugan Kolanji14-Oct-12 3:22
Murugan Kolanji14-Oct-12 3:22 
QuestionRandomize Data of Groupboxes Pin
ASPnoob5-Oct-12 23:38
ASPnoob5-Oct-12 23:38 
AnswerRe: Randomize Data of Groupboxes Pin
Rockstar_7-Oct-12 20:10
professionalRockstar_7-Oct-12 20:10 
Hi Dear,
I have worked on this type of project...
The following is the stored procedure you can use for randomly getting the questions as well as the random options (answers) from the database.
This stored procedure covers almost your 80% of the work, only the thing is you have to bind it to the gridview . If you have any doubts in this you can comment.


//////////////////////////////////////////////////////////////////////////////////////
SQL
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
ALTER
Procedure [dbo].[GetRandomOptionsold]
(@class varchar(max),
@Subject varchar(max),
@ExamType varchar(max),
@School varchar(max)
)

as

Begin

Create
Table #Options(ID int identity(1,1),Fields nvarchar(10))

Insert
into #Options

Select
COLUMN_NAME from INFORMATION_SCHEMA.COLUMNS Where TABLE_NAME='Questions' And COLUMN_NAME like 'O%' Order By NEWID()

--Select * from #Options

Declare
@RandomCols nvarchar(100)

Set
@RandomCols=''

Select
@RandomCols=@RandomCols+Fields+' ,' from #Options

--Select @RandomCols

Set
@RandomCols=(Select REPLACE(Substring(@RandomCols,0,CHARINDEX(' ,',@RandomCols)+2),' ,',' as O1,')

+
SUBSTRING(@RandomCols,CHARINDEX(' ,',@RandomCols)+2,LEN(@RandomCols)))

--Select @RandomCols

Set
@RandomCols=(Select REPLACE(Substring(@RandomCols,0,CHARINDEX(' ,',@RandomCols)+2),' ,',' as O2,')

+
SUBSTRING(@RandomCols,CHARINDEX(' ,',@RandomCols)+2,LEN(@RandomCols)))

--Select @RandomCols

Set
@RandomCols=(Select REPLACE(Substring(@RandomCols,0,CHARINDEX(' ,',@RandomCols)+2),' ,',' as O3,')

+
SUBSTRING(@RandomCols,CHARINDEX(' ,',@RandomCols)+2,LEN(@RandomCols)))

--Select @RandomCols

Set
@RandomCols=(Select REPLACE(Substring(@RandomCols,0,CHARINDEX(' ,',@RandomCols)+2),' ,',' as O4,')

+
SUBSTRING(@RandomCols,CHARINDEX(' ,',@RandomCols)+2,LEN(@RandomCols)))

--Set @RandomCols=SUBSTRING(@RandomCols,0,len(@RandomCols))

--Select @RandomCols

Declare
@strQry nvarchar(MAX)

Set
@strQry=''

Set
@strQry='Select qno,que,'+@RandomCols+'ans from Questions where Class='''+@Class+''' and Subject='''+@Subject+''' and ExamType='''+@ExamType+''' and School='''+@School+''''

exec
(@strQry)

End

//////////////////////////////////////////////////////////////////////
AnswerRe: Randomize Data of Groupboxes Pin
Rockstar_7-Oct-12 20:46
professionalRockstar_7-Oct-12 20:46 
Questionweird problems: nothing is happening!! Pin
Jassim Rahma5-Oct-12 6:50
Jassim Rahma5-Oct-12 6:50 
AnswerRe: weird problems: nothing is happening!! Pin
jkirkerx5-Oct-12 8:43
professionaljkirkerx5-Oct-12 8:43 
GeneralRe: weird problems: nothing is happening!! Pin
Jassim Rahma5-Oct-12 9:36
Jassim Rahma5-Oct-12 9:36 
AnswerRe: weird problems: nothing is happening!! Pin
Rockstar_7-Oct-12 20:15
professionalRockstar_7-Oct-12 20:15 
AnswerRe: weird problems: nothing is happening!! Pin
Sunil_Nikam8-Oct-12 5:27
Sunil_Nikam8-Oct-12 5:27 
GeneralRe: weird problems: nothing is happening!! Pin
Jassim Rahma8-Oct-12 6:52
Jassim Rahma8-Oct-12 6:52 
GeneralRe: weird problems: nothing is happening!! Pin
Jassim Rahma8-Oct-12 7:09
Jassim Rahma8-Oct-12 7:09 
GeneralRe: weird problems: nothing is happening!! Pin
Jassim Rahma8-Oct-12 7:10
Jassim Rahma8-Oct-12 7:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.