|
I need to run my program on my client machine.
I had developed my program on my machine and created the DB on my machine.
Now I need to transfer the db and my EXE file on to another machine
The server name on my machine shows
Running - \\Rch1 - MSSQLServer
But the server name on the second machine
Running - \\Krnot - MSSQLServer
How do I replace the servername.
My code;
Public conn As New OleDbConnection("Provider=sqloledb;server=Rch1;Database=Rch;Trusted_Connection=YES;")
Tnx
|
|
|
|
|
You should always put that kind of information in the app.cofig file. That way it can be changed when the application is moved around. Hardcoding this information into the app is just going to cause problems (as you have seen)
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Pls Could you give me some more info on this.
Tnx
|
|
|
|
|
|
What is the best way of distributing an empty (of transactional data) database in MS_SQL2k?
I have a database which has gone through system test and want to use this as the UAT baseline database - maybe do a backup and restore as a new database..or use tha database copy wizard?
Any other options?
'--8<------------------------
Ex Datis:
Duncan Jones
Merrion Computing Ltd
|
|
|
|
|
Duncan Edwards Jones wrote: I have a database which has gone through system test and want to use this as the UAT baseline database - maybe do a backup and restore as a new database..or use tha database copy wizard?
I have some NUnit tests that restore a database in the TestFixtureSetUp method. It works very well - although sometimes it can be a little slow, so I have a set of delete scripts in reserve if I'm debugging though the unit tests and I need a quick reset between runs.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
-- modified at 9:01 Monday 15th May, 2006
|
|
|
|
|
You can use SQL Server Enterprise Manager to Generate Scripts of your entire database.
Right Click db -> All Tasks -> Generate SQL Script...
Look where you want to go not where you don't want to crash.
Bikers Bible
|
|
|
|
|
Hi,
I have one employ table, i want to find the nth max salary
can anybody know how to write a query please send to me
|
|
|
|
|
Something like this might work:
SELECT TOP 1 EmployeeID, Salary
FROM
(
SELECT TOP n EmployeeID, Salary
FROM EmployeeTable
ORDER BY Salary DESC
) AS TopSalaries
ORDER BY Salary ASC Remember to replace the n in TOP n with the actual literal value that you need (unless you are using SQL Server 2005)
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
If you don't mind temp tables this should work
######
DECLARE @TopSalary int
SET @TopSalary = 10 -- Get me the 10th hightest paid employee
create table #temp(id int Indentity(1,1) employeeID int, salary float)
insert #temp
insert employee, salary from YourTable
ORDER BY SALARY DESC
SELECT * from temp
WHERE ID = 10
Look where you want to go not where you don't want to crash.
Bikers Bible
|
|
|
|
|
|
That will get just the lowest Salary because the ORDER BY clause goes in ASC ending order by default (i.e. Starting with the lowest)
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Select *,sal From Emp X Where n =
(
Select Count(Distinct Sal) From Emp Where sal >=X.sal
)
(Got it from the net somewhere )
By the way Colin, how do you post such nicely formatted code? Do you use any tool for that?
-
-- modified at 23:52 Tuesday 16th May, 2006
|
|
|
|
|
Dinuj Nath wrote: how do you post such nicely formatted code? Do you use any tool for that?
For the code to show up in the orange box, you use the <pre> tag and for the text in red like the TOP n that Colin uses, use the <code> tag that is in the Formatting selection of the Reply to a Message form.
I hope this helps,
Paul
|
|
|
|
|
|
hello,
I am using vb.net and I am a new comer to ADO.net! I have a relational database and I am confusing in it to connect it to vb.net. All I have is 4 tables. I want to make databinding in textboxes within the program. Can someone guide me somewhere pls I am using MS Access 2003 not SQL. But i am trying to use SELECT statements and etc.
Thank you
Adrian De Battista: .Net Programmer, Java Programmer and Web Designer.
-- modified at 6:25 Monday 15th May, 2006
|
|
|
|
|
well i see that no body answear i don't know i think it is easy
this is the way
well i don't know if you know something abt dataset have you heard abt that before ?
this dataset is a tomporary representation of a database in the memory
this dataset is used in the deconnected mode
i hope you know all that sh*t if you don't i can send you a good course of vb.net but in french else you can ask this in microsoft.com in MSDN & i'm sure you will get what you need
if you don't find neither you can just ask me i will help as much as i can i'm a beginner too
try to be good if you can't be the best
|
|
|
|
|
|
Hi
i dont know when use a static method and when a non-static method in the data access layer
suppose we have
#1
public class Customer
{
.
.
.
publuc static DataSet GetCustomerList( int shopID )
{
//Do something and return a dataset
}
.
.
.
}
#2
public class Customer
{
.
.
.
publuc DataSet GetCustomerList( int shopID )
{
//Do something and return a dataset
}
.
.
.
}
#1 or #2 This is the problem
|
|
|
|
|
WDI wrote: i dont know when use a static method and when a non-static method in the data access layer
You didn't say what you want to do with the data access layer.
If you use static methods then everything in the applicatio will route through the static methods which will be using the same set of static fields in the class. If your application is single threaded then you probably don't have anything to worry about. If your application is multi-threaded (e.g. An ASP.NET application - all the sessions are running in the same application) then static methods will be a bottleneck because you'll only be able to allow one query to run at a time.
Does this help?
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
OOOOOPS!
Is asp.net application multi threaded????????????
|
|
|
|
|
Yes. How did you think it can handle multiple requests simulataneously?
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Is any way to build a table base on xml/xsd. Is any way to build xsd from xml. also xsd has some limitation like lentgh of string field.
Any idea ?
So Thanks
|
|
|
|
|
After opening a new xml file write:
<?xml version="1.0" standalone="yes"?>
<Users xmlns="http://www.yourwebsite.net/xmlfilename.xsd" >
<User><!--table name for each record-->
<ID></ID><!--field name-->
<name></name>
<age></age>
</User>
</Users>
Then from XML menu select CreateSchema to create xsd file,
To determine the Key field right click the element in the xml schema,Add,NewKey.
In code-behind page:
void GetUserData(string userID)
{
DataSet ds=new DataSet();
string strpath=Server.MapPath(Request.ApplicationPath);
ds.ReadXmlSchema(strpath+"\\xmlfilename.xsd");
ds.ReadXml(strpath+"\\xmlfilename.xml");
DataRow dr=ds.Tables["User"].Rows.Find(userID);
string username=dr["UserName"].ToString();
}
void SetUserData(string userID)
{
string strpath=Server.MapPath(Request.ApplicationPath);
DataSet ds=new DataSet();
ds.ReadXml("xmlfilename.xml");
DataRow dr=ds.Tables["User"].Rows.Find(userID);
dr["UserName"]="user1name";
ds.WriteXml(strpath+"\\xmlfilename.xml")
}
I am too late but i will never give up
|
|
|
|
|
So Thanks
I have three question. can I build select,insert,update and create table query from xml. how can I Create Schema without visual studio and what about relational database.
thanks
|
|
|
|