|
Oh, I use my computer as sql server, the code which useing "Driver={SQL Server};Server=192.168.1.100;Address=192.168.1.100,1433;Network=DBMSSOCN;User ID=sa;PWD=123456;Database=DaDian2008" works well on my own computer, but doesn't on another computer.
|
|
|
|
|
kcynic wrote: 192.168.1.100
This is a local IP, the other machine is looking for SQL on their machine, not yours. You might try replacing that with a machine name or find out your lan IP. I am presuming you want to use your machine as the SQL server.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
But, 192.168.1.100 is the real local IP of mine and i do want to use my machine as the SQL server. You meant, I should replace Server=192.168.1.100 with Server=MyPcName? But, if so, to a client witch knew its server ip only, how should it configure this argument? Unfortunely, if it's not a practice but a C/S product, one of its user is a orgnization with a plenty of members,they all need to install the client program, so they configure the Server argument with their server's correct name. And for another group, they have to do the similar work! In another words, the installation can't be done automately! right?
|
|
|
|
|
You need to define your requirements
Are you on a LAN with all the clients
How many clients
Is you machine the dev box
Do you have a UAT server or even a database
Do you have a production server/ddatabase
Do you have an IT department, b/c if you are it you are in deep do do.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Oh, there are the answers:
1. All clients within a LAN.
2. My pc is a dev box
3. I have MS SQL Server 2005 installed.
4. Of course no product. I just took that as a example
5. Im not a web developer, so b/s has no help for me.
No matter how many clients would be, i just only want to know how. Thanks
|
|
|
|
|
Depending on whether you use C++ or VB, the connection string is slightly different. Look at connectionstrings.com . Also, you should first make sure that you can connect with C:\WINDOWS\system32\odbcad32.exe before playing with your code.
|
|
|
|
|
Oh, thanks for you reply, i think i got the answer from that page.
|
|
|
|
|
Identify what is your problem. Is that Network problem or SQL Server problem or both?
You are using LAN so test these:
1. Try ping command to/from server & clients’ PCs. (y/n?)
2. Or try file or printer sharing among PCs.
If you failed all above tests, you have Network problem. Otherwise you are facing the problem to connect with SQL Server.
All Mycroft Holmes’s discussions are about Network problem without being sure what the problem is.
I’m waiting to know what your problem is.
|
|
|
|
|
Hi... i dont have any network problem but still i'm not able to connect to MS SQL Server which is in another system of my LAN.... Please provide me what to chect wit SQl server and Connection string... pLZZZZZZZZ.......
|
|
|
|
|
really gives us novices a great place to post our beginner questions:
SELECT COUNT(BookTitle) FROM Book WHERE IsFiction = 1;
I am Indexing the IsFiction field, but not sure if I should be Indexing the BookTitle field too? Any expert thoughts?
Thanks again!
|
|
|
|
|
Not based on that query. If the booktitle field is in a join or a where clause then it may need an index. Take a look at the execution plan and see where the main cost is, if it says table scan then an index will help.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I am not joining on the BookTitle field...I just wasn't sure if Count needed BookTitle to be Indexed when it aggregates the count command. I will leave BookTitle un-indexed, thanks!
|
|
|
|
|
You could in theory get a faster query if you make a composite index on (IsFiction, BookTitle) and booktitle are having many duplicates.
But this is improbable in this case as booktitles are fairly unique, and you will have extra overhead on the inserts and updates.
"When did ignorance become a point of view" - Dilbert
|
|
|
|
|
It is normally good practice to have indexes on fields used in where clauses. However, if IsFiction is a bit field, it will have low selectivity (a measurement of how unique each value is) which will mean that it is highly unlikely that the query optimizer would consider using the index. You are much more likely to find that the optimizer is using a clustered index scan or a table scan.
|
|
|
|
|
maybe in need 2 go back to the basics...can anyone give me a link or two of a basic tutorial that talks about optimization...i always put indexes on Where or Order By fields if I am doing joins on the Where, and if I think the tables are going to have a huge number of records.
also, a simple tutorial link about the Query Optimizer and how to use it would be great too.
Thanks!
|
|
|
|
|
|
I am using VB 2008 & MS Access database
I have a table WebRateList with 2 columns ResFrom and ResTo defined as DateTime, another column WebID defined as Text (allow Null)
When I search:
strSQL = "SELECT * FROM WebRateList WHERE ResFrom < #" & ChkOut & "# AND ResTo > #" & ChkIn & "#"
Then it showed "It is in this range!"
But if I scan the same row with column WebID must be emptied, it didn't get in (infact the WebID is empty)
strSQL = "SELECT * FROM WebRateList WHERE ResFrom < #" & ChkOut & "# AND ResTo > #" & ChkIn & "# AND WebID = NULL"
da = New OleDbDataAdapter(strSQL, dbConn)
dt = New DataTable
da.Fill(dt)
If (dt.Rows.Count() > 0) Then
MsgBox("It is in this range!")
End If
Even I defined the following the result is the same
strSQL = "SELECT * FROM WebRateList WHERE ResFrom < #" & ChkOut & "# AND ResTo > #" & ChkIn & "# AND WebID = '' "
Anyone can help?
|
|
|
|
|
You can't use = NULL, you must use IS NULL.
|
|
|
|
|
It worked!
Thanks for a very quick help
|
|
|
|
|
This one should be easy ...
I cant get a simple parametrized update query to function at all...
This is a simplified version of what I am trying to do...
UPDATE TheDatabase
SET ([Vehicle #] = @NewVehNo)
WHERE ([Vehicle #] = @OldVehNO)
I dont enderstand why this is wrong... I suck at SQL lol...
from MSDN i get the format:
UPDATE ShoppingCart
SET (BookId = @bookid, CustId = @custid, Quantity = @quantity)
WHERE (BookId = @bookid AND CustId = @custid)
|
|
|
|
|
UPDATE targets a table, not a database.
suggestion: stop using those field names full of special characters, and get rid of those square brackets then.
|
|
|
|
|
Get rid of the parens. Such as:
UPDATE Thetable
SET [Vehicle #] = @NewVehNo
WHERE [Vehicle #] = @OldVehNO
and I assume you are updating a table - Yes?
|
|
|
|
|
wait yes... i replaced that for some reason... i am updating a table
UPDATE [dbo].[Pickups & Cars]
SET ([Vehicle #] = @Vehicle_NO)
WHERE ([Vehicle #] = @Vehicle_NO)
this doesnt work...
|
|
|
|
|
Get rid of the parens:
UPDATE [dbo].[Pickups & Cars] SET [Vehicle #] = @Vehicle_NO
WHERE [Vehicle #] = @Vehicle_NO
Have tried the SP in Query Analyzer?
|
|
|
|
|
I guess the parens were messing it up... thanks!
|
|
|
|