|
please clear you scenario still i m giving you an answer .
Solution 1.
you can fill the listbox from dropdown data by using Dictionary or list .
1.first get your data in a dictionary.
2.then fill your list box using this data.
Soultion 2.
ListBox1.Items.Add(DropDownList1.SelectedValue);
|
|
|
|
|
Thx you for you help.
MoreOver I would like know how I can use the Dictionary, my question is how the post the article which I select in my dropdownlist, then how i make to record it by getting back Id
|
|
|
|
|
|
thx guy but i would like to keep the iD for my listbox and keep in one table who have two FKs
Thx
|
|
|
|
|
Hello everyone,
i have a gridview that call a rowupdating command in a ascx file.
i added dropdownlist with postback but i'm getting a null values.
i tried it in aspx file and its working.
what could be the problem?
Thanks in advance,
jyn
|
|
|
|
|
make sure your .ascx file page load contains
if (!IsPostBack)
{}
and you are binding within it .
|
|
|
|
|
Hi!
Does anybody know when specifically this error happens?
-------------------------------------------------------------------------
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 10/5/2012 3:35:46 PM
Event time (UTC): 10/5/2012 5:35:46 AM
Event ID: 185e3ac798ae4f7f96e5fb515ea57c07
Event sequence: 166
Event occurrence: 79
Event detail code: 0
Application information:
Application domain: /LM/W3SVC/32/ROOT-1-129938852424390639
Trust level: Full
Application Virtual Path: /
Application Path: D:\INDIGO8SYNC\PublishedWebsites\Nookie_Subscribe\
Machine name: AUSTRALIA1
Process information:
Process ID: 6856
Process name: w3wp.exe
Account name: IIS APPPOOL\nookiecomau
Exception information:
Exception type: HttpUnhandledException
Exception message: Exception of type 'System.Web.HttpUnhandledException' was thrown.
Request information:
Request URL: http://www.nookie.com.au/default.aspx
Request path: /default.aspx
User host address: 110.143.108.249
User:
Is authenticated: False
Authentication Type:
Thread account name: AUSTRALIA1\Administrator
Thread information:
Thread ID: 12
Thread account name: AUSTRALIA1\Administrator
Is impersonating: True
Stack trace: at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.default_aspx.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Custom event details:
-------------------------------------------------------------------------
Thanks!
<rattlesnake><3:16>
|
|
|
|
|
rattlesnake316 wrote: Does anybody know when specifically this error happens?
Whehe, pointing out a generic exception, without access to code?
Seems you're missing an exception-handler: "at System.Web.UI.Page.HandleError(Exception e)". What happens in that method?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Have you tried to set a break point and step through the code?
In order to help you with this, we would need to see the code that is generating the error and what you were attempting to do when you received it.
|
|
|
|
|
Hi
I have downloaded SharpWebMail from sourceforge, but I am unable to integrate in my existing Asp.Net Project which is made in asp.net 3.5
Please suggest me to integrate this code in my project.
thanks
|
|
|
|
|
Guys;
I have run a code that connect to an excel file on a web service and it worked.
now I run the same code on a windows service running on the same host but it gave me the exception of:
The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.
Help people,so poeple can help you.
|
|
|
|
|
|
Item #4 of the above link states that it is not intended for "Quote: ... a program called from server-side web application such as ASP.NET ...
So what is the preferred method to access data stored in Excel for an ASP.NET application ?
I understand that you don't want to build an OLTP system usign Excel as a datastore ... but I have a situation where there is a spreadsheet which is updated by one department and I was thinking of buidling a simple webpage which would be used as search front-end for folks who do not have "edit" access to the Excel doc. Should be OK? Right?
|
|
|
|
|
If I recall correctly in Win7 Ole JET DB is deprecated and you should use mentioned ACE.OLEDB.12.0.
For older systems use JET. This should be installed with office and one of them should be accessible.
In my app I use web.config connection: jet for production with older version of WinServer and OLEDB for my Win7 dev machine.
I don't know if there is better way.
No more Mister Nice Guy... >: |
|
|
|
|
|
If your application running in 64 bit machine,
change the "Platform target" into X86 in project properties.
I hope it will work for you.
|
|
|
|
|
Hi All, I want to create an exam program consisting of questions and bunch of groupboxes each containing several radio buttons. Each question has a groupbox below it. The questions and their corresponding possible answers are stored on a database which will be bound to the the radio buttons at runtime. To answer an exam question, test takers will click on the radio button next to the correct answer. I would like to give each test taker a different test by rearrange the test questions by randomly changing the order of the questions and randomly changing the order of the possible answers. Randomizing the order of the questions is pretty straight forward using the Random Class to randomly display the questions but I don't know how to randomly bind data from the database to the radio buttons in the groupboxes. Please explain how this can be done or point me to a site where there's a tutorial on doing this if you know of one. Thanks in advance.
modified 6-Oct-12 11:42am.
|
|
|
|
|
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.
//////////////////////////////////////////////////////////////////////////////////////
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()
Declare
@RandomCols nvarchar(100)
Set
@RandomCols=''
Select
@RandomCols=@RandomCols+Fields+' ,' from #Options
Set
@RandomCols=(Select REPLACE(Substring(@RandomCols,0,CHARINDEX(' ,',@RandomCols)+2),' ,',' as O1,')
+
SUBSTRING(@RandomCols,CHARINDEX(' ,',@RandomCols)+2,LEN(@RandomCols)))
Set
@RandomCols=(Select REPLACE(Substring(@RandomCols,0,CHARINDEX(' ,',@RandomCols)+2),' ,',' as O2,')
+
SUBSTRING(@RandomCols,CHARINDEX(' ,',@RandomCols)+2,LEN(@RandomCols)))
Set
@RandomCols=(Select REPLACE(Substring(@RandomCols,0,CHARINDEX(' ,',@RandomCols)+2),' ,',' as O3,')
+
SUBSTRING(@RandomCols,CHARINDEX(' ,',@RandomCols)+2,LEN(@RandomCols)))
Set
@RandomCols=(Select REPLACE(Substring(@RandomCols,0,CHARINDEX(' ,',@RandomCols)+2),' ,',' as O4,')
+
SUBSTRING(@RandomCols,CHARINDEX(' ,',@RandomCols)+2,LEN(@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
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
If it has not solved your problem , please let me know ...
|
|
|
|
|
I have the following code and SQL:
sql_connection = new MySqlConnection(ConfigurationManager.ConnectionStrings["SQLdb"].ConnectionString);
sql_connection.Open();
sql_command = new MySqlCommand("sp_delete_channel", sql_connection);
sql_command.CommandType = CommandType.StoredProcedure;
sql_command.Parameters.AddWithValue("param_channel_id", channel_id).MySqlDbType = MySqlDbType.Int32;
sql_command.Parameters.AddWithValue("param_volow_member_id", Convert.ToInt32(Session["volow_member_id"])).MySqlDbType = MySqlDbType.Int32;
sql_command.Parameters.Add("param_is_channel_created", MySqlDbType.Bit).Direction = ParameterDirection.Output;
int result_rows = sql_command.ExecuteNonQuery();
if (Convert.ToBoolean(sql_command.Parameters["param_is_channel_created"].Value) != true)
{ Session["is_channel_created"] = false; }
and this is MySQL stored procedure:
BEGIN
SET param_is_channel_created = TRUE;
DELETE FROM member_posts WHERE member_channel_id = param_channel_id;
DELETE FROM member_channels WHERE member_channel_id = param_channel_id;
IF NOT EXISTS (SELECT member_channel_id FROM member_channels WHERE volow_member_id = param_volow_member_id) THEN
BEGIN
UPDATE volow_members SET is_channel_created = FALSE;
SET param_is_channel_created = FALSE;
END;
END IF;
END
but nothing is happending and I am sure all are ok because I change something in the storedprocedure and I got and error but with the above I don''t get any error and page is just reloading with the same data when I click the delete button?
Kindly help...
|
|
|
|
|
I don't write in c-sharp, but vb is my thing, but I did my best to rewrite the function in how I think it should be written. The catch will tell you what's wrong with your function or TSQL.
Also it's best practice to package everything first, then open the database, execute, and close the database all in 1 shot.
I can't test your TSQL, in my tester program, that would take another 20 minutes for me.
exitCode int = 2;
sql_connection = new MySqlConnection(ConfigurationManager.ConnectionStrings["SQLdb"].ConnectionString);
sql_command = new MySqlCommand("sp_delete_channel", sql_connection);
sql_command.CommandType = CommandType.StoredProcedure;
param_Channel_ID SqlParameter = new SqlParameter("@param_channel_id", SqlDbType.Int);
param_Channel_ID.Value = channel_id;
sql_command.Add(param_Channel_ID);
param_Member_ID SqlParameter = new SqlParameter("@param_volow_member_id", SqlDbType.Int);
param_Member_ID.Value = Convert.ToInt32(Session["volow_member_id"]);
sql_command.Add(param_Memeber_ID);
param_Created SqlParameter = new SqlParameter("@param_is_channel_created", SqlDbType.Bit);
param_Created.Value = Convert.ToBoolean(ParameterDirection.Output);
sql_command.Add(param_Created_ID);
try {
sql_connection.Open();
sql_reader SqlDataReader = sql_command.ExecuteReader();
sql_command.ExecuteNonQuery();
sql_reader.Close();
sql_connection.Close();
exitCode = 0
}
catch ex as SQLException {
exitCode = 1
}
return exitCode;
BEGIN
SET param_is_channel_created = TRUE;
DELETE FROM member_posts WHERE member_channel_id=@param_channel_id;
DELETE FROM member_channels WHERE member_channel_id=@param_channel_id;
IF NOT EXISTS (SELECT member_channel_id FROM member_channels WHERE volow_member_id=@param_volow_member_id) THEN
BEGIN
SET param_is_channel_created = FALSE;
UPDATE volow_members SET is_channel_created=param_is_channel_created;
END;
END IF;
END
|
|
|
|
|
thanks for the reply
but the problem is my code is not throwing any exception error as if everything is normal and it's not doing what is should do (deleting the record)!!
|
|
|
|
|
May be your gridview data is not refreshing because of the dataset , please check, and Is this deleted from the database?
|
|
|
|
|
Please check the value of "int result_rows" also at first glance it seems that "IF NOT EXISTS" part wont be executed atall returning always "param_is_channel_created = TRUE"
|
|
|
|
|
there is datagrid VijayChauhan123
Sunil: the DELETE is before the IF NOT EXIST so it should have been invoked.
|
|
|
|
|
I even tried this simple delete but still not working:
sql_connection = new MySqlConnection(ConfigurationManager.ConnectionStrings["SQLdb"].ConnectionString);
sql_command = new MySqlCommand("sp_delete_channel", sql_connection);
sql_command.CommandType = CommandType.StoredProcedure;
sql_connection.Open();
sql_command.Parameters.AddWithValue("param_channel_id", channel_id).MySqlDbType = MySqlDbType.Int32;
int result_row = sql_command.ExecuteNonQuery();
and SQL:
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_delete_channel`(IN param_channel_id int, IN param_volow_member_id int, OUT param_is_channel_created bit)
BEGIN
DELETE FROM member_posts WHERE member_channel_id = param_channel_id;
DELETE FROM member_channels WHERE member_channel_id = param_channel_id;
IF NOT EXISTS (SELECT member_channel_id FROM member_channels WHERE volow_member_id = param_volow_member_id) THEN
BEGIN
UPDATE volow_members SET is_channel_created = FALSE;
SET param_is_channel_created = FALSE;
END;
ELSE SET param_is_channel_created = TRUE;
END IF;
END
|
|
|
|
|