Click here to Skip to main content
15,901,035 members
Home / Discussions / Database
   

Database

 
AnswerRe: How to Select the Next 20 records in SQL server? Pin
Riaan Booyzen24-Feb-09 23:55
Riaan Booyzen24-Feb-09 23:55 
QuestionSP Optimization Pin
Guvera24-Feb-09 19:20
Guvera24-Feb-09 19:20 
AnswerRe: SP Optimization Pin
Wendelius24-Feb-09 19:34
mentorWendelius24-Feb-09 19:34 
GeneralRe: SP Optimization Pin
Guvera24-Feb-09 19:38
Guvera24-Feb-09 19:38 
QuestionMega Pole - What is Your Favorite Database? Pin
pinaldave24-Feb-09 19:18
pinaldave24-Feb-09 19:18 
AnswerRe: Mega Pole - What is Your Favorite Database? Pin
Colin Angus Mackay25-Feb-09 14:19
Colin Angus Mackay25-Feb-09 14:19 
GeneralRe: Mega Pole - What is Your Favorite Database? Pin
pinaldave25-Feb-09 14:31
pinaldave25-Feb-09 14:31 
GeneralRe: Mega Pole - What is Your Favorite Database? Pin
Colin Angus Mackay25-Feb-09 21:19
Colin Angus Mackay25-Feb-09 21:19 
QuestionRaising events in stored procedure Pin
Guvera24-Feb-09 19:04
Guvera24-Feb-09 19:04 
AnswerRe: Raising events in stored procedure Pin
Wendelius24-Feb-09 19:26
mentorWendelius24-Feb-09 19:26 
GeneralRe: Raising events in stored procedure Pin
Guvera24-Feb-09 19:40
Guvera24-Feb-09 19:40 
GeneralRe: Raising events in stored procedure Pin
Wendelius24-Feb-09 20:02
mentorWendelius24-Feb-09 20:02 
Questionsql query parser Pin
me_aaryan24-Feb-09 19:02
me_aaryan24-Feb-09 19:02 
AnswerRe: sql query parser Pin
Wendelius24-Feb-09 19:24
mentorWendelius24-Feb-09 19:24 
Questionhow to get name of the file before extention from database.. Pin
anujbanka178424-Feb-09 17:20
anujbanka178424-Feb-09 17:20 
AnswerRe: how to get name of the file before extention from database.. Pin
Wendelius24-Feb-09 18:01
mentorWendelius24-Feb-09 18:01 
QuestionMS sql system table Pin
billcodes24-Feb-09 17:04
billcodes24-Feb-09 17:04 
AnswerRe: MS sql system table Pin
Wendelius24-Feb-09 17:47
mentorWendelius24-Feb-09 17:47 
QuestionADO DataGrid View Pin
nomibarbarian24-Feb-09 9:44
professionalnomibarbarian24-Feb-09 9:44 
AnswerRe: ADO DataGrid View Pin
Wendelius24-Feb-09 18:04
mentorWendelius24-Feb-09 18:04 
QuestionRe: ADO DataGrid View [modified] Pin
nomibarbarian26-Feb-09 8:13
professionalnomibarbarian26-Feb-09 8:13 
QuestionGetting "OleDbCommand.Prepare method requires all parameters to have an explicitly set type." error while updating a dataset Pin
Pr@teek B@h!24-Feb-09 4:16
Pr@teek B@h!24-Feb-09 4:16 
Hi,
I am using dataset to update/insert the data in the database. Whenever its about to update the dataset, it gives me the following error:
"OleDbCommand.Prepare method requires all parameters to have an explicitly set type."

Can somebody please help me with this problem?

Here is my code:

using (OleDbConnection conn = new OleDbConnection(ConnectionString))
{
try
{
conn.Open();
OleDbCommand selectCmd = new OleDbCommand("select * from tableA where col1=? and col2=?", conn);
selectCmd.Parameters.AddWithValue("@col1", val1);
selectCmd.Parameters.AddWithValue("@col2", val2);

OleDbDataAdapter adapter = new OleDbDataAdapter(selectCmd);
OleDbCommandBuilder builder = new OleDbCommandBuilder(adapter);

DataSet selectDS = new DataSet();
adapter.Fill(selectDS, "TableA");

DataTable table = selectDS.Tables["TableA"];
DataRow row = null;
					
int mode = 0;		//0 = create, 1 = edit

if (table.Rows.Count > 0)
{
row = table.Rows[0];
mode = 1;
}
else
{
row = table.NewRow();
}
					
row["col1"] = val1;
row["col2"] = val2;
row["col3"] = val3;

if (mode == 0)
{
table.Rows.Add(row);
}

adapter.Update(selectDS, "TableA");  // this is where the problem occurs
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
conn.Close();
}
}


Thank you,

Prateek
AnswerRe: Getting "OleDbCommand.Prepare method requires all parameters to have an explicitly set type." error while updating a dataset Pin
Ennis Ray Lynch, Jr.24-Feb-09 4:26
Ennis Ray Lynch, Jr.24-Feb-09 4:26 
GeneralRe: Getting "OleDbCommand.Prepare method requires all parameters to have an explicitly set type." error while updating a dataset Pin
Pr@teek B@h!24-Feb-09 4:48
Pr@teek B@h!24-Feb-09 4:48 
AnswerRe: Getting "OleDbCommand.Prepare method requires all parameters to have an explicitly set type." error while updating a dataset Pin
Wendelius24-Feb-09 6:43
mentorWendelius24-Feb-09 6:43 

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.