Showing posts with label inserting. Show all posts
Showing posts with label inserting. Show all posts

Thursday, February 16, 2012

asp.net want to make SQL time format of 00:00:00:000 to 14:42:51:153 when inserting in dat

I have asp.net 1.1 web form and it inserts date and time in SQL database, but it insert only date not time , It insert date time in following format

2002-01-22 00:00:00.000

some one tell me why it is not inserting time or why it is inserting time as 00:00:00:000.

I want to my time to look like 14:42:51:153. (format)

How can I change my time format

give me asp.net codes for time formating or what do I need to do to resolve the problem,

thank you

maxmax

I think your application is not sending the date properly. Do a response.write of the value you are sending to the db and verify.

Thursday, February 9, 2012

ASP.NET +Inserting data from xml in SQL Server Database table from ASP.NET

hi

I want to read data from XML file and insert that data from XML file into the Database Table From ASP.NET page.

plz give me the code to do this using DataAdapter.Update(ds)

Hi There,

Below is a simple way to read xml data and update xml datatable to SQLserver database. ( Run a loop if you have multiple table to update )

DataSet dsXML =newDataSet();

dsXML.ReadXml(@."c:\XMLPath\file.xml");

if ( dsXML.Tables.Count > 0 )if ( dsXML.Tables[0].Rows.Count > 0 )

{

// Select table structure to dataadapter

OleDbDataAdapter dataAdapter =newOleDbDataAdapter("SELECT * FROM [" + dsXML.Tables[0].TableName +"] WHERE 1 = 2","YourConnectionString");

// Use dataadapter to update to readed xml data

dataAdapter.Update(dsXML.Tables[0]);

dataAdapter.Dispose();

}

}