|
hi all,
i am new to SQL Server but little strong in vb.net
i want to create Backup file of any database of SQL server and again restore them to server . So how can i do this task Programmatically. Also what is the option when Authentication mode is Windows or Server or Mix-Mode
|
|
|
|
|
You are not mentioned here SQL Server version.
If you are using SQL2005 then do some research on SQL Server Management Objects (SMO). It provides the all kind of Database management facility including backup and restore.
Parwej Ahamad
R & D: REST services with WCF
|
|
|
|
|
Windows Authentication uses active directory credentials
Mix mode will also allow standard sql server authentication.
There are pros and cons to both of these, and entire articles/books written on them. We use windows authentication for the developers and admins who need to interact with the database directly and SQL credentials for the applications to interact.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
hi all,
i am new bie in SQL server
i want to store Database with my application on client machine . However i know i add one for setup for Database but how can get the server name of system (mean SQL server name on client machine). Reason behind this question is that i use server name in connection string as following
Dim ConnectionString As String = "Data Source=s-1\SQLEXPRESS;Initial Catalog=abc;Integrated Security=True"
i use above string .In which server name is "s-1\SQLExpress" . so how can replace this server name to client machine server name?
|
|
|
|
|
I believe this will be the name of your computer unless you can install an instance of SQL Express.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
sir,First of all , i am new bie
actually i dont know what is the configuration of client machine . so i suppose user simply add the database in their Server. and run my application . so how could i get the Server Part in following connection string
Dim ConnectionString As String = "Data Source=s-1\SQLEXPRESS;Initial Catalog=abc;Integrated Security=True"
Here server is S-1
and instance is SQLExpress. Correct me if i wrong
|
|
|
|
|
Nope you do not need correcting. I would make it a prerequisite of your install package - ask the use for the server name to use.
I'm not sure the Express version announces itself to the network like SQL server does. Even if it does, how are you going to pick between the # number of SQL instances on the network. Last I looked we have over 300 SQL server instances on ours.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
sir, i does not properly get you
Are you want to say that I add Database as Prerequiste of Installation Package and After installation of application, when user run the application first time, then it ask for Server Name and store server name in some place like text file or registry ? Please correct me
|
|
|
|
|
I think what he want to say is, your database creation progrom should ask the database information, as sql expressoin cant be reachable accross network, so you also need to change the connection string. after getting the database info you update your configuration file.
|
|
|
|
|
Mycroft Holmes wrote: over 300 SQL server instances on ours
Oh boy.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Yeah I work for a bank, they have 4 data centers, 2 production and 2 DR. They run 2 discreet networks UAT and production. Deployment is a PITA
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: have 4 data centers, 2 production and 2 DR
Sounded like with that many instances, you are at a good sized shop.
Mycroft Holmes wrote: Deployment is a PITA
I imagine so. helps after a tough day in any shop
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Paul Conrad wrote: you are at a good sized shop.
Yeah but I work in one department and IT hate me, I have a mandate to "get the job done" and worry about enterprise requirements later. Therefore I'm not subject to the endless meetings IT seem to require before they allow you to start coding, it also means there is no such thing as a requirements document either so it has it's drawbacks.
Thanks for the beer, I may wait as it is 9:30 on a Sunday and thats a bit early even for me!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
This article, Finding SQL Servers on the Network[^] may be worth looking at. Not sure how it responds to SQL Express or SQL 2008.
The above article is based on odbc, this other one, Enumerating SQL servers on a Network[^] looks good, too.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
modified on Saturday, July 26, 2008 9:08 PM
|
|
|
|
|
Hi
I've a Table Table1.And it's structure is
RoleID RoleDescription Department
1 Manager Accounts
2 Senior Manager Finance
and I want to have a Table like
Columnname Columnvalue Date
RoleID 1 2/5/2008
RoleDescription Manager 2/5/2008
Department Accounts 2/5/2008
RoleID 2 2/5/2008
RoleDescription Senior Manager 2/5/2008
Department Finance 2/5/2008
Can anyone tell how?
thanks in advance
Sri
|
|
|
|
|
I realy dont understand what you just asked
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Dear gurus,
I am developing a charting application that should plot [double] values against [DateTime] values. In a single turn, there can be as much as 10 million data points.
What I do is to extract the data from SQL Server and use ChartDirector to plot it. For about 1 million data, extraction takes 25 seconds and plotting takes 20 seconds.
This is a lot of time to wait for user. Can you please suggest me any?
like sampling to reduce the data, or fast extraction, or fast plotting?
Thanking you!
|
|
|
|
|
The obvious one is to reduce the number of data points over the entire time frame IE get 1 data point per week/month. Allow the user to drill into a specific week/month at which time you may show all or data points. You can't actually see 10mio datapoints, the values would become irrelevant over such a large size.
BTW 45 sec to get 10mio rows of data seems eminently reasonable to me.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thank you, Mycroft Holmes.
But the problem is that I cannot afford to miss out the outliers among the data. If I pick out 1 data poing per month, there is high chance that any outlier may miss out.
Should taking the mean withing the time span solve the problem?
Thanking you.
|
|
|
|
|
mahabir wrote: If I pick out 1 data poing per month,
There is a trading graph the shows hi/low and volume for period per period (Day per year). That will solve your problem. There are at least 3 other methods of displaying the data without dumping our millions of rows!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
By using ADO to deal with excel, I can create the table in Excel successfully, but when I try to insert a new column, the SQL command failed.
ALTER TABLE tablename INSERT COLUMN col1 FLOAT
Why?
system
|
|
|
|
|
Question comes instantly to mind - WHY THE FREAKIN HEEL ARE YOU USING EXCEL AS YOUR DATABASE. Unless there is an overriding business reason to do this you are setting yourself up for a disaster. Please use SQL Express if possible, Access if you really must use office but Excel NNnnnnnooooooo!
Sorry that I cannot help you with this I am not even sure it is possible. Quite possibly I would not even if it is possible!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Yes, the customer need a report in an Excel file.
system
|
|
|
|
|
followait wrote: customer need a report in an Excel file
Ok thats a different problem. Do not create a database for outputting to excel. If you do a search in the articles here you will find many examples for output to excel from both SQL and UI.
You have 2 choices, output a csv file and allow excel to do the conversion when it is opened. This is by far the simplest method and probably the widest used.
Alternatively you can manually create an excel sheet by manipulating the excel application object. This will give you formatting options but will take a lot more work and require the excel application to be installed on the client computer.
3rd option it to use a reporting engine to render an excel report. This give you the best format but will require you get a handle on a report engine.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
The client I'm working for is using LINQ to SQL behind a BLL of sorts. So each CRUD operation gets its own context. Here's an example of the Save method:
<br />
public static Step Save(Step step)<br />
{<br />
using ( KRATDataContext context = new KRATDataContext( Helpers.EnvironmentState.CurrentConnectionString ) )<br />
{<br />
Step oldStep = step.StepID > 0 ? context.Steps.Single( p => p.StepID == step.StepID ) : null;<br />
<br />
if ( oldStep == null )<br />
{<br />
context.Steps.InsertOnSubmit( step );<br />
}<br />
else<br />
{<br />
oldStep.Description = step.Description;<br />
oldStep.PotentialHazard = step.PotentialHazard;<br />
oldStep.ActionsToReduceRisk = step.ActionsToReduceRisk;<br />
oldStep.InitialRiskCellID = step.InitialRiskCellID;<br />
oldStep.PostRiskCellID = step.PostRiskCellID;<br />
oldStep.DateCreated = step.DateCreated;<br />
oldStep.RiskAnalysisID = step.RiskAnalysisID;<br />
oldStep.DisplayIndex = step.DisplayIndex;<br />
}<br />
context.SubmitChanges();<br />
<br />
return step;<br />
}<br />
}<br />
<br />
I have implemented functionality which allows a user to change the display order of a "Step" record by clicking an up/down arrow which essentially swaps the value of DisplayIndex for two separate records. Like this:
<br />
protected void Swap(int stepId1, stepId2)<br />
{<br />
Step step1 = Step.GetOne(stepId1);<br />
Step step2 = Step.GetOne(stepId2);<br />
<br />
Swap(step1, step2);<br />
<br />
using( System.Transactions.TransactionScope txCtx = new System.Transactions.TransactionScope()){<br />
Step.Save(step1);<br />
Step.Save(step2);<br />
<br />
txCtx.Complete();<br />
}<br />
}<br />
The important fact being demonstrated here is that each save operation has its own DataContext. So when the 2nd call to Save() is made I get an exception because I have explicitly turned off DTC (ie. I don't allow remote DTC operations). But these two records are in the same table.
So here's what I'm looking for:
1) Can someone else confirm this for me, but duplicating the error I get.
2) Is there a way around this, other than using the same DataContext object?
3) I'll need to double check, but this doesn't happen to me when I use the EnterpriseLibrary connection objects with TransactionScope. So is this a bug? Or at least something that should be changed so it works the way EnterpriseLibrary does?
#2 is important because while fixing this issue for the specific case above (both objects are based on the same database table) I have other cases where I'll have to create specialized methods in my data access layer which allow me to use the same data context so I can wrap operations on different tables with the same DataContext.
As always, I appreciate the help.
[Edit]
Here's the exception detail:
System.Transactions.TransactionManagerCommunicationException was unhandled by user code
Message="Communication with the underlying transaction manager has failed."
Source="System.Transactions"
InnerException: System.Runtime.InteropServices.COMException
Message="Error HRESULT E_FAIL has been returned from a call to a COM component."
Source="System.Transactions"
[/Edit]
|
|
|
|