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

ASP.NET

 
QuestionDataList Updating Problem Pin
jitendrafaye16-May-10 22:15
jitendrafaye16-May-10 22:15 
QuestionUncommon reason - Object reference not set to an instance of an object. Pin
DonnieHunniecutt16-May-10 5:19
DonnieHunniecutt16-May-10 5:19 
AnswerRe: Uncommon reason - Object reference not set to an instance of an object. Pin
michaelschmitt17-May-10 0:10
michaelschmitt17-May-10 0:10 
GeneralRe: Uncommon reason - Object reference not set to an instance of an object. Pin
DonnieHunniecutt17-May-10 1:52
DonnieHunniecutt17-May-10 1:52 
GeneralRe: Uncommon reason - Object reference not set to an instance of an object. Pin
TheyCallMeMrJames17-May-10 6:16
TheyCallMeMrJames17-May-10 6:16 
GeneralRe: Uncommon reason - Object reference not set to an instance of an object. Pin
DonnieHunniecutt17-May-10 6:41
DonnieHunniecutt17-May-10 6:41 
AnswerRe: Uncommon reason - Object reference not set to an instance of an object. Pin
Eddy Vluggen17-May-10 0:22
professionalEddy Vluggen17-May-10 0:22 
GeneralRe: Uncommon reason - Object reference not set to an instance of an object. Pin
DonnieHunniecutt17-May-10 1:59
DonnieHunniecutt17-May-10 1:59 
QuestionHow to export arabic data to csv? Pin
Athul from Sharjah16-May-10 3:17
Athul from Sharjah16-May-10 3:17 
AnswerRe: How to export arabic data to csv? Pin
sweet_light7-Sep-10 0:17
sweet_light7-Sep-10 0:17 
QuestionRoleManager issues with SharePoint FBA Pin
BaggyG16-May-10 2:02
BaggyG16-May-10 2:02 
Questionwhere to give image url to display image [modified] Pin
developerit15-May-10 21:06
developerit15-May-10 21:06 
AnswerRe: where to give image url to display image Pin
Not Active16-May-10 2:31
mentorNot Active16-May-10 2:31 
AnswerRe: where to give image url to display image Pin
michaelschmitt17-May-10 0:09
michaelschmitt17-May-10 0:09 
QuestionDatabase Error when retrieving specific records from a table Pin
Eagle3215-May-10 11:26
Eagle3215-May-10 11:26 
AnswerRe: Database Error when retrieving specific records from a table Pin
Tarakeshwar Reddy15-May-10 12:41
professionalTarakeshwar Reddy15-May-10 12:41 
The problem is because you are not setting the parameter value. Also, you need to use the ? and not a named parameter @ThreadID in the query.

public DataSet RetrieveComments(int threadID)
{
   String connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|/MyDatabase.mdb;Persist Security Info=True";
   OleDbConnection dbConn = new OleDbConnection(connString);

   String queryString = "SELECT * FROM [Comments] WHERE [ThreadID] = ?";
   OleDbCommand oleDbCommand = new OleDbCommand(queryString, dbConn);
   oleDbCommand.Parameters.Add("@threadID", OleDbType.Integer, 10).Value = threadID;

   OleDbDataAdapter dbAdapter = new OleDbDataAdapter();
   dbAdapter.SelectCommand = oleDbCommand;
   dbConn.Open();

   DataSet dataSet = new DataSet();
   dbAdapter.Fill(dataSet, "Comments");

   dbConn.Close();
   return dataSet;
}


Make sure the parameters and syntax are okay. Also use the using statement to make sure your objects get disposed properly.
AnswerRe: Database Error when retrieving specific records from a table Pin
hyjiacan15-May-10 14:27
hyjiacan15-May-10 14:27 
GeneralRe: Database Error when retrieving specific records from a table Pin
Tarakeshwar Reddy15-May-10 17:20
professionalTarakeshwar Reddy15-May-10 17:20 
QuestionError trying to set the style sheet in the code behind. Pin
Steve Holdorf15-May-10 9:45
Steve Holdorf15-May-10 9:45 
AnswerRe: Error trying to set the style sheet in the code behind. Pin
Not Active15-May-10 17:23
mentorNot Active15-May-10 17:23 
QuestionWeb Server serving as a TCP/IP communication server as well Pin
Stevo Z15-May-10 4:58
Stevo Z15-May-10 4:58 
AnswerRe: Web Server serving as a TCP/IP communication server as well Pin
DeepToot18-May-10 8:39
DeepToot18-May-10 8:39 
GeneralRe: Web Server serving as a TCP/IP communication server as well Pin
Stevo Z18-May-10 11:05
Stevo Z18-May-10 11:05 
Questiondata problem Pin
bapu288915-May-10 0:58
bapu288915-May-10 0:58 
AnswerRe: data problem Pin
Not Active15-May-10 3:03
mentorNot Active15-May-10 3:03 

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.