Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SqlException

Author  Topic 

DekaFlash
Starting Member

8 Posts

Posted - 2008-01-23 : 09:38:11
I am new to Sql Server 2005, I am using vb.net 2005 to manually connect to the database but I am getting the following error
Login failed for user 'BM-PC/B-Mustafa'

Can you please advise?

Thanks

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2008-01-23 : 10:18:18
how are you connecting to the sql server? with sql or windows authentication?

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com <- new version out
Go to Top of Page

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2008-01-23 : 11:11:24
Are you able to logon via the SQL Server Client tools?

Jack Vamvas
--------------------
Search IT jobs from multiple sources- http://www.ITjobfeed.com
Go to Top of Page

DekaFlash
Starting Member

8 Posts

Posted - 2008-01-24 : 07:45:37
In my application I am trying to connect using Windows Authentication.

I can connect using Sql Server Management Studio
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2008-01-24 : 07:56:55
what is your connection string?

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com <- new version out
Go to Top of Page

DekaFlash
Starting Member

8 Posts

Posted - 2008-01-24 : 08:24:52
Dim connectionString As String = "server=BM-PC; database=EquinexMasterSql;" + "uid=BM-PC/B-Mustafa; pwd=;"
Go to Top of Page

sunil
Constraint Violating Yak Guru

282 Posts

Posted - 2008-01-24 : 08:31:36
Try
Dim connectionString As String = "server=BM-PC; database=EquinexMasterSql;uid=BM-PC\\B-Mustafa;pwd=;"
Go to Top of Page

DekaFlash
Starting Member

8 Posts

Posted - 2008-01-24 : 08:44:26
I altered the connection string as you suggested Sunil but I am getting the same error.
Go to Top of Page

sunil
Constraint Violating Yak Guru

282 Posts

Posted - 2008-01-24 : 08:52:57
I tell you how I got my first connection string problem sorted out. Drag SqlDatasource on one of your webform. Right click on it and select properties.Search for connectionstring property under Data.Select New connection. Provide all information and do remember to click Test Connection button to see if it is successfull or not. Once it is successful, copy it and use it. you may have to be wary of \ problem when you paste it in your code.if it is \ then make it \\. Hope it helps.
Go to Top of Page

DekaFlash
Starting Member

8 Posts

Posted - 2008-01-24 : 09:11:14
I am developing a Winforms application.

I've sorted the connection problem and I am now getting a Parent Columns and Child Columns don't have type-matching columns.

I have modified the data types within my Sql Database so they now match but vb.net is still generating the same error.

Is there anyway to display and update data of different types in different columns of the same data grid or by using different components

Dim cmdstring As String = "SELECT * FROM HorseName"
Dim dataAdapter As New SqlClient.SqlDataAdapter(cmdstring, conn)
Dim ds As New DataSet()
dataAdapter.Fill(ds, "HorseName")

cmdstring = "SELECT * FROM LF1"
dataAdapter = New SqlClient.SqlDataAdapter(cmdstring, conn)
dataAdapter.Fill(ds, "LF1")

Dim Relation As New DataRelation("RaceDetails", EquinexMasterSqlDataSet.HorseName.HorseNameColumn, EquinexMasterSqlDataSet.LF1.LF1Column)
EquinexMasterSqlDataSet.Relations.Add(Relation)

Dim dv As New DataView(ds.Tables("HorseName"))
DataGridView2.DataSource = dv

Thanks
Go to Top of Page

sunil
Constraint Violating Yak Guru

282 Posts

Posted - 2008-01-24 : 11:21:39
What error you are getting? If you could post it.

Dim cmdstring As String = "SELECT * FROM HorseName"
Dim dataAdapter As New SqlClient.SqlDataAdapter(cmdstring, conn)
Dim ds As New DataSet()
dataAdapter.Fill(ds, "HorseName")

cmdstring = "SELECT * FROM LF1"
dataAdapter = New SqlClient.SqlDataAdapter(cmdstring, conn)
dataAdapter.Fill(ds, "LF1")

Dim Relation As New DataRelation("RaceDetails", EquinexMasterSqlDataSet.HorseName.HorseNameColumn, EquinexMasterSqlDataSet.LF1.LF1Column)
EquinexMasterSqlDataSet.Relations.Add(Relation)
ds.Relations.Add(Relation)//I would have this not above as you have declared dataset as "ds" and not "EquinexMasterSqlDataSet". So you should be adding relation to ds and not EquinexMasterSqlDataSet.
Dim dv As New DataView(ds.Tables("HorseName"))
DataGridView2.DataSource = dv
Go to Top of Page

DekaFlash
Starting Member

8 Posts

Posted - 2008-01-24 : 11:55:53
I have modified the code as you suggest but I am still getting the error Parent Columns and Child Columns don't have type-matching columns.
Go to Top of Page

sunil
Constraint Violating Yak Guru

282 Posts

Posted - 2008-01-24 : 23:56:48
Will recommend you following links for creating relationship between 2 tables in a dataset.
http://www.dotnetjohn.com/articles.aspx?articleid=63
http://www.aspfree.com/c/a/ASP.NET-Code/A-sample-code-to-Create-a-relationship-between-two-tables/

Also, search msdn for Dataset.You will find best help about dataset.
Go to Top of Page

DekaFlash
Starting Member

8 Posts

Posted - 2008-01-25 : 03:38:31
Will this work for a Desktop (Winforms Application)?
Go to Top of Page

sunil
Constraint Violating Yak Guru

282 Posts

Posted - 2008-01-25 : 03:53:32
I believe ADO.NET remains same for both windows and web. Go through the links I provided to understand relations between tables in dataset. You can also try to run these samples. dotnetjohn site also has downloadable code.
Go to Top of Page
   

- Advertisement -