Click here to Skip to main content
15,889,883 members
Home / Discussions / Database
   

Database

 
GeneralRecursive Triggers Pin
afronaut21-Oct-04 13:33
afronaut21-Oct-04 13:33 
GeneralRe: Recursive Triggers Pin
WoutL22-Oct-04 1:25
WoutL22-Oct-04 1:25 
GeneralSQL query - deleting main row, its related rows, and their related rows Pin
Luis Alonso Ramos21-Oct-04 8:58
Luis Alonso Ramos21-Oct-04 8:58 
GeneralRe: SQL query - deleting main row, its related rows, and their related rows Pin
TimWallace21-Oct-04 9:32
TimWallace21-Oct-04 9:32 
GeneralRe: SQL query - deleting main row, its related rows, and their related rows Pin
Luis Alonso Ramos21-Oct-04 9:53
Luis Alonso Ramos21-Oct-04 9:53 
GeneralADO question Pin
Tom Wright21-Oct-04 5:32
Tom Wright21-Oct-04 5:32 
GeneralDatalist with pages Pin
David Fawn21-Oct-04 5:03
David Fawn21-Oct-04 5:03 
QuestionWhy won't this update to my Database? Pin
fortyonejb21-Oct-04 4:52
fortyonejb21-Oct-04 4:52 
Okay so i'm having some trouble with adding to my database through the dataset. i can read from it and it prints just fine, i run the code okay with no errors, but it simply doesn't add the record, i've left it simple here just so i can get it right before i start adding the extra functionality. okay so the table name is UserID, and i want to add into the table, what am i doing wrong?

private void btnAddRecord_Click(object sender, System.EventArgs e)<br />
		{<br />
			string ConnectString =@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\salesleadmgmt.mdb";<br />
			OleDbConnection AddConnection = new OleDbConnection(ConnectString);<br />
			OleDbDataAdapter addAdapter = new OleDbDataAdapter("Select * from UserID", AddConnection);<br />
			DataSet addSet = new DataSet();<br />
			DataRow addRow;<br />
			<br />
			OleDbCommandBuilder addCommandBuilder = new OleDbCommandBuilder(addAdapter);<br />
<br />
			addAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;<br />
			addAdapter.Fill(addSet, "UserID");<br />
			<br />
			<br />
			addRow = addSet.Tables["UserID"].NewRow();<br />
			addRow["UsrName"] = "Bob";<br />
			addRow["passwr"] = "Bobpwd";<br />
			addRow["UsrID"] = "6";<br />
			addSet.Tables["UserID"].Rows.Add(addRow);<br />
			addSet.AcceptChanges();<br />
			addAdapter.Update(addSet, "UserID");<br />
			addAdapter.Fill(addSet, "UserID");<br />
			UsrGrid.DataSource = addSet;<br />
			UsrGrid.DataBind();<br />
			<br />
		<br />
		}

Now, its working so far as on the UsrGrid i see the "bob" entry, but afterwards its not in the database, why isnt the DataSet writing to my database???

this runs in the .CS file, i don't get any of the write lines or anything, it does run on a button click, i have another button click that works fine, i'll show that one, whats wrong with this first one?

working display click
private void Button1_Click(object sender, System.EventArgs e)<br />
		{<br />
			string ConnectString =@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\salesleadmgmt.mdb";<br />
			OleDbConnection CustConnection = new OleDbConnection(ConnectString);<br />
			CustConnection.Open();<br />
<br />
			DataSet CustSet = new DataSet();<br />
			OleDbDataAdapter CustAdapt = new OleDbDataAdapter("SELECT * FROM CustInfo", CustConnection);<br />
			CustAdapt.Fill(CustSet);<br />
			CustConnection.Close();<br />
			CustGrid.DataSource = CustSet;<br />
			CustGrid.DataBind();<br />
		}

Generalupdating a database in C# Pin
steve_rm21-Oct-04 4:10
steve_rm21-Oct-04 4:10 
GeneralVB, ADO, XP - Which one is falling over?! Pin
Pete Belcher20-Oct-04 23:04
Pete Belcher20-Oct-04 23:04 
GeneralRe: VB, ADO, XP - Which one is falling over?! Pin
Michael Potter21-Oct-04 5:05
Michael Potter21-Oct-04 5:05 
GeneralSimple Question on Oracle dbms_utility.get_time Pin
devvvy20-Oct-04 20:34
devvvy20-Oct-04 20:34 
GeneralRe: Simple Question on Oracle dbms_utility.get_time Pin
DiWa20-Oct-04 22:44
DiWa20-Oct-04 22:44 
QuestionDatasets - Totally Stumped - Am I stupid or something? Pin
david@mindplay.com20-Oct-04 12:03
david@mindplay.com20-Oct-04 12:03 
AnswerRe: Datasets - Totally Stumped - Am I stupid or something? Pin
Colin Angus Mackay20-Oct-04 22:00
Colin Angus Mackay20-Oct-04 22:00 
GeneralRe: Datasets - Totally Stumped - Am I stupid or something? Pin
david@mindplay.com21-Oct-04 8:16
david@mindplay.com21-Oct-04 8:16 
GeneralRe: Datasets - Totally Stumped - Am I stupid or something? Pin
Colin Angus Mackay21-Oct-04 11:44
Colin Angus Mackay21-Oct-04 11:44 
GeneralRe: Datasets - Totally Stumped - Am I stupid or something? Pin
david@mindplay.com21-Oct-04 12:11
david@mindplay.com21-Oct-04 12:11 
GeneralRe: Datasets - Totally Stumped - Am I stupid or something? Pin
Colin Angus Mackay21-Oct-04 12:23
Colin Angus Mackay21-Oct-04 12:23 
GeneralRe: Datasets - Totally Stumped - Am I stupid or something? Pin
david@mindplay.com21-Oct-04 12:38
david@mindplay.com21-Oct-04 12:38 
GeneralRe: Datasets - Totally Stumped - Am I stupid or something? Pin
Colin Angus Mackay21-Oct-04 12:45
Colin Angus Mackay21-Oct-04 12:45 
GeneralRe: Datasets - Totally Stumped - Am I stupid or something? Pin
david@mindplay.com21-Oct-04 12:55
david@mindplay.com21-Oct-04 12:55 
GeneralRe: Datasets - Totally Stumped - Am I stupid or something? Pin
Colin Angus Mackay21-Oct-04 11:52
Colin Angus Mackay21-Oct-04 11:52 
GeneralRe: Datasets - Totally Stumped - Am I stupid or something? Pin
david@mindplay.com21-Oct-04 12:22
david@mindplay.com21-Oct-04 12:22 
GeneralRe: Datasets - Totally Stumped - Am I stupid or something? Pin
Colin Angus Mackay21-Oct-04 12:28
Colin Angus Mackay21-Oct-04 12:28 

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.