Showing posts with label form. Show all posts
Showing posts with label form. Show all posts

Friday, March 30, 2012

putting multiple xml files data into database in a single transaction

Super AngryFirst of all i do not know whether this is the right form to ask the question

Let me describe the scenario iam using

Iam generating xml files at a particular place and sending them to a server

xml1|------->dataset1---------->adapter1.update(dataset1)

xml2|-------->dataset2---------->adapter2.update(dataset2)

xml3|-------->dataset3---------->adapter3.update(dataset3)

all thethree updates should happen in onlyone transaction if any one of the update fails then the transaction should rollback

can anyone tell me a way to do it

i am desperately in search of any ways to do it can anybody help pleaseSad

If the 3 SqlDataAdapters are using the same connection, maybe you can try to embed the updates in a single transaction opened on the connection:

using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["myConn"].ToString()))
{

conn.open;

//build your SqlDataAdapters on the same conneciton

SqlTransaction st;
st=conn.BeginTransaction("tran1");
adapter1.update(dataset1);

adapter2.update(dataset2);

adapter3.update(dataset3);

st.Commit();
}

|||

ExecuteReader requires the command to have a transaction when the connection assigned to the command is in a pending local transaction. The Transaction property of the command has not been initialized

This is the error iam getting bcoz iam using the command builder to update the table using dataset cant we use command builder and transaction at the same time

or we should use only sqlcommand to the method

can anybody tell me the solution cant we use transaction and adapter and commandbuilder at the same time

[:'(]

Wednesday, March 28, 2012

Putting Data From DataTable/DataSet into SQL Server Table?

Hello,

I created this DataTable, add rows of data to it, and then display the data on to a form via a repeater.

Dim ds As DataSet = New DataSet
Dim dtTableName As DataTable = New DataTable("dtTableName")
dtTableName.Columns.Add("Description")
dtTableName.Columns.Add("ItemNumber")
dtTableName.Columns.Add("Quantity")
dtTableName.Columns.Add("Price")
ds.Tables.Add(dtTableName)

What I need to do now is create a table in SQL Server and update the database with the data I've collect in my dataset. How do I bind and update this data to a sql server table?

Thanks!
James

Check out this walkthrough (it uses a DataGrid and DataSet):
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbwlkWalkthroughUpdatingDataUsingDatabaseUpdateQueryInWebForms.asp

Tuesday, March 20, 2012

Pulling SQL Server information in C#

I'm looking to pull information such as uptime, ip, status, db name, etc from my sql server database to display on a form. I'd like to get more detailed if I could, such as current load on database, threads, etc. Does anyone know if this is possible using
C#?
Hi Chris,
Most of these are retrieved via the @.@. variables. For a full list look in
BOL
Select @.@.CPU_BUSY
You may also want to look at sp_monitor
sp_monitor
I hope this helps
Greg O
Looking for SQL Scripts, Need Help? http://www.SQL-Scripts.com
Document all your databases now.
http://www.ag-software.com/ags_scribe_index.aspx
Crosstab queries from SQL Server.
http://www.ag-software.com/xp_ags_crosstab.aspx
Edit Extended Properties as easy as can be.
http://www.ag-software.com/ags_SSEPE_index.aspx
"Chris Stewart" <CompiledMonkey@.comcast.net> wrote in message
news:6D0351C3-76E2-4901-A269-630E89EAC66A@.microsoft.com...
> I'm looking to pull information such as uptime, ip, status, db name, etc
from my sql server database to display on a form. I'd like to get more
detailed if I could, such as current load on database, threads, etc. Does
anyone know if this is possible using C#?
|||Just to add - of course you can catch this info in C#. Stored procedures
give you rowsets and you can use DataReader to catch it; scalar values can
be caught as output parameters of the Command object.
Dejan Sarka, SQL Server MVP
Associate Mentor
Solid Quality Learning
More than just Training
www.SolidQualityLearning.com
"Greg Obleshchuk" <greg-n-o-s-p-a-m-@.ag-s-o-f-t-w-a-r-e.com> wrote in
message news:uMFMbRyKEHA.2576@.TK2MSFTNGP12.phx.gbl...
> Hi Chris,
> Most of these are retrieved via the @.@. variables. For a full list look in
> BOL
> Select @.@.CPU_BUSY
> You may also want to look at sp_monitor
> sp_monitor
>
> --
> I hope this helps
> --
> Greg O
> Looking for SQL Scripts, Need Help? http://www.SQL-Scripts.com
> Document all your databases now.
> http://www.ag-software.com/ags_scribe_index.aspx
> Crosstab queries from SQL Server.
> http://www.ag-software.com/xp_ags_crosstab.aspx
> Edit Extended Properties as easy as can be.
> http://www.ag-software.com/ags_SSEPE_index.aspx
>
> "Chris Stewart" <CompiledMonkey@.comcast.net> wrote in message
> news:6D0351C3-76E2-4901-A269-630E89EAC66A@.microsoft.com...
> from my sql server database to display on a form. I'd like to get more
> detailed if I could, such as current load on database, threads, etc. Does
> anyone know if this is possible using C#?
>

Pulling SQL Server information in C#

I'm looking to pull information such as uptime, ip, status, db name, etc from my sql server database to display on a form. I'd like to get more detailed if I could, such as current load on database, threads, etc. Does anyone know if this is possible using C#?Hi Chris,
Most of these are retrieved via the @.@. variables. For a full list look in
BOL
Select @.@.CPU_BUSY
You may also want to look at sp_monitor
sp_monitor
I hope this helps
--
Greg O
Looking for SQL Scripts, Need Help? http://www.SQL-Scripts.com
Document all your databases now.
http://www.ag-software.com/ags_scribe_index.aspx
Crosstab queries from SQL Server.
http://www.ag-software.com/xp_ags_crosstab.aspx
Edit Extended Properties as easy as can be.
http://www.ag-software.com/ags_SSEPE_index.aspx
"Chris Stewart" <CompiledMonkey@.comcast.net> wrote in message
news:6D0351C3-76E2-4901-A269-630E89EAC66A@.microsoft.com...
> I'm looking to pull information such as uptime, ip, status, db name, etc
from my sql server database to display on a form. I'd like to get more
detailed if I could, such as current load on database, threads, etc. Does
anyone know if this is possible using C#?|||Just to add - of course you can catch this info in C#. Stored procedures
give you rowsets and you can use DataReader to catch it; scalar values can
be caught as output parameters of the Command object.
--
Dejan Sarka, SQL Server MVP
Associate Mentor
Solid Quality Learning
More than just Training
www.SolidQualityLearning.com
"Greg Obleshchuk" <greg-n-o-s-p-a-m-@.ag-s-o-f-t-w-a-r-e.com> wrote in
message news:uMFMbRyKEHA.2576@.TK2MSFTNGP12.phx.gbl...
> Hi Chris,
> Most of these are retrieved via the @.@. variables. For a full list look in
> BOL
> Select @.@.CPU_BUSY
> You may also want to look at sp_monitor
> sp_monitor
>
> --
> I hope this helps
> --
> Greg O
> Looking for SQL Scripts, Need Help? http://www.SQL-Scripts.com
> Document all your databases now.
> http://www.ag-software.com/ags_scribe_index.aspx
> Crosstab queries from SQL Server.
> http://www.ag-software.com/xp_ags_crosstab.aspx
> Edit Extended Properties as easy as can be.
> http://www.ag-software.com/ags_SSEPE_index.aspx
>
> "Chris Stewart" <CompiledMonkey@.comcast.net> wrote in message
> news:6D0351C3-76E2-4901-A269-630E89EAC66A@.microsoft.com...
> > I'm looking to pull information such as uptime, ip, status, db name, etc
> from my sql server database to display on a form. I'd like to get more
> detailed if I could, such as current load on database, threads, etc. Does
> anyone know if this is possible using C#?
>

Pulling SQL Server information in C#

I'm looking to pull information such as uptime, ip, status, db name, etc fro
m my sql server database to display on a form. I'd like to get more detailed
if I could, such as current load on database, threads, etc. Does anyone kno
w if this is possible using
C#?Hi Chris,
Most of these are retrieved via the @.@. variables. For a full list look in
BOL
Select @.@.CPU_BUSY
You may also want to look at sp_monitor
sp_monitor
I hope this helps
--
Greg O
Looking for SQL Scripts, Need Help? http://www.SQL-Scripts.com
Document all your databases now.
http://www.ag-software.com/ags_scribe_index.aspx
Crosstab queries from SQL Server.
http://www.ag-software.com/xp_ags_crosstab.aspx
Edit Extended Properties as easy as can be.
http://www.ag-software.com/ags_SSEPE_index.aspx
"Chris Stewart" <CompiledMonkey@.comcast.net> wrote in message
news:6D0351C3-76E2-4901-A269-630E89EAC66A@.microsoft.com...
> I'm looking to pull information such as uptime, ip, status, db name, etc
from my sql server database to display on a form. I'd like to get more
detailed if I could, such as current load on database, threads, etc. Does
anyone know if this is possible using C#?|||Just to add - of course you can catch this info in C#. Stored procedures
give you rowsets and you can use DataReader to catch it; scalar values can
be caught as output parameters of the Command object.
Dejan Sarka, SQL Server MVP
Associate Mentor
Solid Quality Learning
More than just Training
www.SolidQualityLearning.com
"Greg Obleshchuk" <greg-n-o-s-p-a-m-@.ag-s-o-f-t-w-a-r-e.com> wrote in
message news:uMFMbRyKEHA.2576@.TK2MSFTNGP12.phx.gbl...
> Hi Chris,
> Most of these are retrieved via the @.@. variables. For a full list look in
> BOL
> Select @.@.CPU_BUSY
> You may also want to look at sp_monitor
> sp_monitor
>
> --
> I hope this helps
> --
> Greg O
> Looking for SQL Scripts, Need Help? http://www.SQL-Scripts.com
> Document all your databases now.
> http://www.ag-software.com/ags_scribe_index.aspx
> Crosstab queries from SQL Server.
> http://www.ag-software.com/xp_ags_crosstab.aspx
> Edit Extended Properties as easy as can be.
> http://www.ag-software.com/ags_SSEPE_index.aspx
>
> "Chris Stewart" <CompiledMonkey@.comcast.net> wrote in message
> news:6D0351C3-76E2-4901-A269-630E89EAC66A@.microsoft.com...
> from my sql server database to display on a form. I'd like to get more
> detailed if I could, such as current load on database, threads, etc. Does
> anyone know if this is possible using C#?
>