Click here to Skip to main content
15,891,253 members
Home / Discussions / ASP.NET
   

ASP.NET

 
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 
Hi,

I am trying to retrieve specific records from a table by specifying the parameter value at run time but the following error keeps occuring when i pass in a value of the correct data type.

System.Data.OleDb.OleDbException: No value given for one or more required parameters.
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr)
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.OleDb.OleDbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)
at Service.RetrieveComments(Int32 ThreadID)


As you can tell from the error message I am using Microsoft Access database provider.

The data type for ThreadID is 'Number' and the field size is set to 'long integer'. The field does exist in the table. In my code I even tried changing datatype from 'int' to 'uint64' but that didnt solve the problem.

Here is the code I had developed.
<br />
[WebMethod]<br />
    public DataSet RetrieveComments(int ThreadID)<br />
    {<br />
<br />
        String queryString = "SELECT * FROM [Comments] WHERE" + "([ThreadID]=@ThreadID)";<br />
        DataSet dataSet = new DataSet();<br />
        String connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|/MyDatabase.mdb;Persist Security Info=True";<br />
        OleDbConnection dbConn = new OleDbConnection(connString);<br />
        OleDbDataAdapter dbAdapter = new OleDbDataAdapter(queryString, dbConn);<br />
        dbConn.Open()<br />
        dbAdapter.Fill(dataSet, "Comments");<br />
        dbConn.Close();<br />
        return dataSet;<br />
    }<br />

Is there anything wrong with the above code?

I have tried the above SQL query in MS Access and it runs fine providing I remove the quotes and the "+" operator.

I would much appreciate if anybody could assist me please?

Thanks in advance.
AnswerRe: Database Error when retrieving specific records from a table Pin
Tarakeshwar Reddy15-May-10 12:41
professionalTarakeshwar Reddy15-May-10 12:41 
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 
QuestionRe: data problem Pin
bapu288915-May-10 6:59
bapu288915-May-10 6:59 
AnswerRe: data problem Pin
Not Active15-May-10 7:24
mentorNot Active15-May-10 7:24 
GeneralRe: data problem Pin
bapu288915-May-10 7:43
bapu288915-May-10 7:43 
QuestionMaster-Content Page postback issues Pin
trunkwala_abbas15-May-10 0:07
trunkwala_abbas15-May-10 0:07 
AnswerRe: Master-Content Page postback issues Pin
Not Active15-May-10 3:05
mentorNot Active15-May-10 3:05 
QuestionEvents are not firing Pin
4anusha414-May-10 20:41
4anusha414-May-10 20:41 
AnswerRe: Events are not firing Pin
janani1316-May-10 17:22
janani1316-May-10 17:22 

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.