Click here to Skip to main content
16,011,374 members
Home / Discussions / C#
   

C#

 
AnswerRe: C# to Manipulate Excel? Pin
Nick Parker10-Aug-04 4:14
protectorNick Parker10-Aug-04 4:14 
Generaldynamically adding tabpages to a tabcontrol Pin
samithas9-Aug-04 17:53
samithas9-Aug-04 17:53 
GeneralRe: dynamically adding tabpages to a tabcontrol Pin
Heath Stewart9-Aug-04 17:57
protectorHeath Stewart9-Aug-04 17:57 
GeneralRe: dynamically adding tabpages to a tabcontrol Pin
samithas9-Aug-04 18:47
samithas9-Aug-04 18:47 
GeneralRe: dynamically adding tabpages to a tabcontrol Pin
sreejith ss nair9-Aug-04 20:06
sreejith ss nair9-Aug-04 20:06 
GeneralDrag and Drop to Desktop Pin
c-minor9-Aug-04 17:32
c-minor9-Aug-04 17:32 
GeneralRe: Drag and Drop to Desktop Pin
Heath Stewart9-Aug-04 17:54
protectorHeath Stewart9-Aug-04 17:54 
Generalado .net sql insert - should be simple but don't get it Pin
JeromeKJerome9-Aug-04 14:07
JeromeKJerome9-Aug-04 14:07 
I am trying to adapt the product registration sample code supplied with Inside Visual Studio .Net. The server side asp in the sample reads an XML stream from a request header into an XMLDocument and assigns it to string variables as so:

private void Page_Load(object sender, System.EventArgs e)
{
//Load registration info XML from the request header:
System.IO.StreamReader sr = new System.IO.StreamReader(Request.InputStream);
Response.ContentType = "text/text";

string strXML = sr.ReadLine();

//
//should be able to replace the code below
//with readXML from the input stream directly
//into the DataSet as so:
//
//Registration1 registration = new Registration1();
//registration.ReadXml(sr, XmlReadMode.Auto);
//

System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
strXML = System.Web.HttpUtility.HtmlDecode(strXML);
xmlDoc.LoadXml(strXML);

//Unpack the registration info using XPath:
string firstName = xmlDoc.SelectSingleNode("Registration/FirstName").InnerText;
string lastName = xmlDoc.SelectSingleNode("Registration/LastName").InnerText;
string companyName = xmlDoc.SelectSingleNode("Registration/CompanyName").InnerText;
string address = xmlDoc.SelectSingleNode("Registration/Address").InnerText;
string aptSuite = xmlDoc.SelectSingleNode("Registration/AptSuite").InnerText;
string city = xmlDoc.SelectSingleNode("Registration/City").InnerText;
string state = xmlDoc.SelectSingleNode("Registration/State").InnerText;
string zip = xmlDoc.SelectSingleNode("Registration/Zip").InnerText;
string country = xmlDoc.SelectSingleNode("Registration/Country").InnerText;
string phoneAreaCode = xmlDoc.SelectSingleNode("Registration/PhoneAreaCode").InnerText;
string phone = xmlDoc.SelectSingleNode("Registration/Phone").InnerText;
string email = xmlDoc.SelectSingleNode("Registration/EMail").InnerText;

//TODO: Store the registration info for later use...


//
//if ProductRegistrationSQL is the database and
//the cols defined the same as the strings above
//and XML stream read directly into the dataset
//it should be a simple matter to insert the row //into the database as so:
//
//sqlDataAdapter1.Update(registration);
//

Response.Write("Thank-you for registering, "+firstName+"!");
Response.End();
}

Being new to C# and ADO .Net, I'm having a tough time with the four-in-one update concept. I've used the wizard in designer to create the select, update, insert and delete commands and I can see them in the property page for the adapter. But I just don't get how in the code to tell update that what I want to do is insert, not update.

This should be child's play but I'm stumped. What am I missing?

GeneralRe: ado .net sql insert - should be simple but don't get it Pin
Heath Stewart9-Aug-04 18:01
protectorHeath Stewart9-Aug-04 18:01 
GeneralRe: ado .net sql insert - should be simple but don't get it Pin
JeromeKJerome10-Aug-04 6:23
JeromeKJerome10-Aug-04 6:23 
GeneralRe: ado .net sql insert - should be simple but don't get it Pin
Heath Stewart10-Aug-04 6:29
protectorHeath Stewart10-Aug-04 6:29 
GeneralRe: ado .net sql insert - should be simple but don't get it Pin
JeromeKJerome10-Aug-04 8:17
JeromeKJerome10-Aug-04 8:17 
GeneralRe: ado .net sql insert - should be simple but don't get it Pin
Heath Stewart10-Aug-04 9:44
protectorHeath Stewart10-Aug-04 9:44 
GeneralThin Client Pin
Anton Dorrestijn9-Aug-04 12:53
Anton Dorrestijn9-Aug-04 12:53 
GeneralRe: Thin Client Pin
Nick Parker9-Aug-04 13:52
protectorNick Parker9-Aug-04 13:52 
GeneralMixing .NET languages Pin
paulains9-Aug-04 12:47
paulains9-Aug-04 12:47 
GeneralRe: Mixing .NET languages Pin
Mark Greenwood9-Aug-04 13:27
Mark Greenwood9-Aug-04 13:27 
GeneralRe: Mixing .NET languages Pin
paulains9-Aug-04 17:51
paulains9-Aug-04 17:51 
GeneralRe: Mixing .NET languages Pin
Heath Stewart9-Aug-04 18:05
protectorHeath Stewart9-Aug-04 18:05 
GeneralRe: Mixing .NET languages Pin
Nick Parker9-Aug-04 13:45
protectorNick Parker9-Aug-04 13:45 
GeneralRe: Mixing .NET languages Pin
paulains9-Aug-04 17:56
paulains9-Aug-04 17:56 
GeneralArrays in c# Pin
cheesepirate9-Aug-04 9:04
cheesepirate9-Aug-04 9:04 
GeneralRe: Arrays in c# Pin
Reinout Hillmann9-Aug-04 9:51
sussReinout Hillmann9-Aug-04 9:51 
GeneralRe: Arrays in c# Pin
cheesepirate9-Aug-04 10:00
cheesepirate9-Aug-04 10:00 
GeneralRe: Arrays in c# Pin
Nick Parker9-Aug-04 10:21
protectorNick Parker9-Aug-04 10:21 

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.