Click here to Skip to main content
15,892,161 members
Home / Discussions / Database
   

Database

 
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 
QuestionConverting Datatype from float to decimal...... Pin
Sasmi_Office23-Feb-09 20:17
Sasmi_Office23-Feb-09 20:17 
AnswerRe: Converting Datatype from float to decimal...... Pin
Mycroft Holmes23-Feb-09 21:34
professionalMycroft Holmes23-Feb-09 21:34 
GeneralRe: Converting Datatype from float to decimal...... Pin
Sasmi_Office23-Feb-09 23:50
Sasmi_Office23-Feb-09 23:50 
AnswerRe: Converting Datatype from float to decimal...... Pin
Rob Philpott23-Feb-09 22:05
Rob Philpott23-Feb-09 22:05 
JokeRe: Converting Datatype from float to decimal...... Pin
WoutL24-Feb-09 1:09
WoutL24-Feb-09 1:09 
GeneralRe: Converting Datatype from float to decimal...... Pin
Rob Philpott24-Feb-09 2:01
Rob Philpott24-Feb-09 2:01 
GeneralHoi? Pin
Luc Pattyn24-Feb-09 1:53
sitebuilderLuc Pattyn24-Feb-09 1:53 
GeneralRe: Converting Datatype from float to decimal...... Pin
Ennis Ray Lynch, Jr.24-Feb-09 3:54
Ennis Ray Lynch, Jr.24-Feb-09 3:54 
QuestionProblem on sql server 2005 SP2 :Failed to retrieve data for this request. (Microsoft.SqlServer.SmoEnum Pin
Rami Said Abd Alhalim23-Feb-09 19:45
Rami Said Abd Alhalim23-Feb-09 19:45 
QuestionRe: Problem on sql server 2005 SP2 :Failed to retrieve data for this request. (Microsoft.SqlServer.SmoEnum Pin
Andy_L_J23-Feb-09 20:59
Andy_L_J23-Feb-09 20:59 
AnswerRe: Problem on sql server 2005 SP2 :Failed to retrieve data for this request. (Microsoft.SqlServer.SmoEnum Pin
Rami Said Abd Alhalim23-Feb-09 21:49
Rami Said Abd Alhalim23-Feb-09 21:49 
QuestionI want your idear and solving !!! Pin
Golden Jing23-Feb-09 17:58
Golden Jing23-Feb-09 17:58 
AnswerRe: I want your idear and solving !!! Pin
Wendelius23-Feb-09 18:11
mentorWendelius23-Feb-09 18:11 
GeneralRe: I want your idear and solving !!! Pin
Golden Jing23-Feb-09 21:44
Golden Jing23-Feb-09 21:44 

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.