Click here to Skip to main content
16,004,806 members
Home / Discussions / Database
   

Database

 
AnswerRe: Progress Bar with MySQL Pin
S Douglas23-Jul-06 20:38
professionalS Douglas23-Jul-06 20:38 
GeneralRe: Progress Bar with MySQL Pin
Rabbit1724-Jul-06 18:20
Rabbit1724-Jul-06 18:20 
GeneralRe: Progress Bar with MySQL Pin
S Douglas24-Jul-06 22:22
professionalS Douglas24-Jul-06 22:22 
Questioncopy data from existing table to existing table Pin
md_refay19-Jul-06 9:18
md_refay19-Jul-06 9:18 
AnswerRe: copy data from existing table to existing table Pin
Ennis Ray Lynch, Jr.19-Jul-06 9:41
Ennis Ray Lynch, Jr.19-Jul-06 9:41 
Questioncopy data from table to table Pin
md_refay19-Jul-06 9:06
md_refay19-Jul-06 9:06 
AnswerRe: copy data from table to table Pin
Ennis Ray Lynch, Jr.19-Jul-06 9:07
Ennis Ray Lynch, Jr.19-Jul-06 9:07 
QuestionNull reference exception when trying to use DataAdapter Update Pin
webbsk19-Jul-06 8:56
webbsk19-Jul-06 8:56 
I keep getting an exception when I call the DataAdapter Update method.
I have been trying to figure out what is causing the null reference
exception for this code for what seems like forever:

private void DoInserts(OdbcDataAdapter odbcDataAdapter, string
tableName)
{
DataTable dataTableChanged =

dsTapes.Tables[tableName].GetChanges(DataRowState.Added);

if ((dataTableChanged != null) &&
(dataTableChanged.Rows.Count > 0))
{
// Open the connection if its not already open.
if (odbcConnection.State !=
System.Data.ConnectionState.Open)
{
odbcConnection.Open();
}

//Create a new transaction.
odbcDataAdapter.InsertCommand.Transaction =
odbcConnection.BeginTransaction();

try
{
//Submit the changes.
odbcDataAdapter.Update(dsTapes,
dataTableChanged.TableName.ToString());
//Commit the changes and close the connection.
odbcDataAdapter.InsertCommand.Transaction.Commit();
}
catch (Exception ex)
{

odbcDataAdapter.InsertCommand.Transaction.Rollback();
throw (ex);
}
}
}

The exception information has not been helpful. All it says is: "Object
reference not set to an instance of an object."

I don't know if this will help, but the Insert command looks like this:

tapeLogInsert = odbcConnection.CreateCommand();
tapeLogInsert.CommandText =
"INSERT INTO " + tapeLogODBCName.Trim()
+ " (NBR, Backup_Name, BakDate, ScrDate, Location, "
+ "Tape_No, Tape_Set, Usage, Comment, UseDate) "
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
tapeLogInsert.Parameters.Add(new OdbcParameter("NBR",
OdbcType.Int));
tapeLogInsert.Parameters["NBR"].SourceColumn = "nbr";
tapeLogInsert.Parameters.Add("Backup_Name", OdbcType.Char, 17,
"backup_name");
tapeLogInsert.Parameters.Add(new OdbcParameter("BakDate",
OdbcType.DateTime));
tapeLogInsert.Parameters["BakDate"].SourceColumn = "bakdate";
tapeLogInsert.Parameters.Add(new OdbcParameter("ScrDate",
OdbcType.DateTime));
tapeLogInsert.Parameters["ScrDate"].SourceColumn = "scrdate";
tapeLogInsert.Parameters.Add("Location", OdbcType.Char, 1,
"location");
tapeLogInsert.Parameters.Add(new OdbcParameter("Tape_No",
OdbcType.SmallInt));
tapeLogInsert.Parameters["Tape_No"].SourceColumn = "tape_no";
tapeLogInsert.Parameters.Add(new OdbcParameter("Tape_Set",
OdbcType.SmallInt));
tapeLogInsert.Parameters["Tape_Set"].SourceColumn = "tape_set";
tapeLogInsert.Parameters.Add(new OdbcParameter("Usage",
OdbcType.SmallInt));
tapeLogInsert.Parameters["Usage"].SourceColumn = "usage";
tapeLogInsert.Parameters.Add("Comment", OdbcType.VarChar, 50,
"comment");
tapeLogInsert.Parameters.Add(new OdbcParameter("UseDate",
OdbcType.DateTime));
tapeLogInsert.Parameters["UseDate"].SourceColumn = "usedate";
tapeLogAdapter.InsertCommand = tapeLogInsert;

Does any one have any idea what is going on here or how to go about
finding out? Any suggestions would be appreciated: I don't even know
how to figure out which reference is null!
AnswerRe: Null reference exception when trying to use DataAdapter Update Pin
Rabbit1726-Jul-06 3:53
Rabbit1726-Jul-06 3:53 
QuestionMicrosoft Access mdb files (OleDb) Pin
RaduCiumag19-Jul-06 4:27
RaduCiumag19-Jul-06 4:27 
AnswerRe: Microsoft Access mdb files (OleDb) Pin
Rob Graham19-Jul-06 5:12
Rob Graham19-Jul-06 5:12 
GeneralRe: Microsoft Access mdb files (OleDb) Pin
RaduCiumag19-Jul-06 8:26
RaduCiumag19-Jul-06 8:26 
GeneralRe: Microsoft Access mdb files (OleDb) Pin
Rob Graham19-Jul-06 10:05
Rob Graham19-Jul-06 10:05 
GeneralRe: Microsoft Access mdb files (OleDb) Pin
RaduCiumag19-Jul-06 19:04
RaduCiumag19-Jul-06 19:04 
NewsBatch scripting for MS Access / Excel databases Pin
imhogan18-Jul-06 23:31
imhogan18-Jul-06 23:31 
QuestionSelect statment Pin
Amarni18-Jul-06 21:14
Amarni18-Jul-06 21:14 
AnswerRe: Select statment Pin
Colin Angus Mackay18-Jul-06 22:18
Colin Angus Mackay18-Jul-06 22:18 
GeneralRe: Select statment Pin
Amarni18-Jul-06 22:56
Amarni18-Jul-06 22:56 
GeneralRe: Select statment Pin
Subramaniam s.V.18-Jul-06 23:42
Subramaniam s.V.18-Jul-06 23:42 
GeneralRe: Select statment Pin
Paddy Boyd19-Jul-06 1:00
Paddy Boyd19-Jul-06 1:00 
QuestionUnable to Configure SQL MAIL Pin
k_bhawna18-Jul-06 20:45
k_bhawna18-Jul-06 20:45 
AnswerRe: Unable to Configure SQL MAIL Pin
Eric Dahlvang19-Jul-06 3:38
Eric Dahlvang19-Jul-06 3:38 
Questionupdate a dataBase Table with a dataSet Table [modified] Pin
cosmindp18-Jul-06 7:23
cosmindp18-Jul-06 7:23 
AnswerRe: update a dataBase Table with a dataSet Table Pin
Not Active18-Jul-06 8:39
mentorNot Active18-Jul-06 8:39 
GeneralRe: update a dataBase Table with a dataSet Table Pin
cosmindp18-Jul-06 8:46
cosmindp18-Jul-06 8:46 

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.