Showing posts with label learning. Show all posts
Showing posts with label learning. Show all posts

Sunday, March 25, 2012

(newbie) Cant connect to msde Database,

Hi,
I am an ASP.net newbie learning thru databasing now.
When setting up and connectiong to Database, i am prompted at SQL Server
Authentication for a user name and password
When I installed, thru the CMD under Start: Run in Windows 2000, i believe i
specified "sa" and "password" for user name and password. but now i get an
error, trying to input that.
"unable to connect to database.
Login failed for user "sa" Reason : not associated with a trusted SQL Server
connection"

What am i doing wrong? if i mistyped the password info when setting up,
where can i check it? or reset it?

Please someone help me

RaphaelSo are you using a ASP.Net script to connect to the DB?

The SQL connection should look like:

server=localhost;Trusted_Connection=true;database=theDB;user id=sa;password=password

Does that make sense to you?

Adrian|||um,

No not at first site, I am a newbie, remember!
I am trying to run from the web matrix project, and i simply cannot create a new msde database.

Do you have any further advice?

Thanks

Raphael

Thursday, March 22, 2012

(GUID problem) What is wrong with this code ?

Hi, just learning SQL2000.
I have this code:
mSQL = "UPDATE Contactpersonen SET Naam=? WHERE ContactpersoonID=?"
Command = New SqlClient.SqlCommand(mSQL, C_CP)
Command.Parameters.Add("Naam", txtNaam.Text)
Command.Parameters.Add("CPID", SqlDbType.UniqueIdentifier).Value = m_CP_ID

where m_CP_ID is defined as a GUID in:
Public Property m_CP_ID() As Guid
Get
If Not viewstate("m_CP_ID") Is Nothing Then
Return viewstate("m_CP_ID")
End If
'Return 0
End Get
Set(ByVal Value As Guid)
viewstate("m_CP_ID") = Value
End Set
End Property

When running the app I got this error:
Server Error in '/4D' Application.
------------------------

Line 1: Incorrect syntax near 'Naam'. Line 1: Incorrect syntax near '?'.(points to mSQL above)
I know it has something to do with the GUID, but I cannot guess what.
Help is appreciated, Ger.


Try this:
mSQL = "UPDATE Contactpersonen SETNaam=@.Naam WHEREContactpersoonID=@.CPID"
Command = New SqlClient.SqlCommand(mSQL, C_CP)
Command.Parameters.Add("@.Naam", txtNaam.Text)
Command.Parameters.Add("@.CPID", SqlDbType.UniqueIdentifier).Value = m_CP_ID
|||Hey SonuKapoor, that works !!!!!!
Thanks a lot, every day I learn more and more... thanks to guys as you,
regards from the North Sea,
Ger.