ConnectionString error


Author
Message
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
I figured, however, that this would allow you to add another one to your, "They shouldn't be allowed to use our framework, if:" list. [BigGrin]




LOL...the thought NEVER crossed my mind...we have all been there! When you get in the heat of the battle sometimes you just resort to "getting the job done" and so I totally understand!
Marcel Heitlager
Marcel Heitlager
StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)
Group: StrataFrame Users
Posts: 84, Visits: 835
The reason why I didn't do it that way is because it makes too much sense. Especially since I allready did it the correct way in the function right below it. Blush



I figured, however, that this would allow you to add another one to your, "They shouldn't be allowed to use our framework, if:" list. BigGrin



As always, thanks again.



Public Function BackupDatabase(ByVal dbname As String) As Boolean



Using cmd As New SqlCommand()



cmd.CommandType = CommandType.StoredProcedure

cmd.CommandText = "dbo.BackupDatabase"

cmd.Parameters.Add("@dbname", SqlDbType.NVarChar, 128)

cmd.Parameters("@dbname").Value = dbname.Trim



Me.ExecuteNonQuery(cmd)



End Using

End Function

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Well, remember that the ES is actually where the connection string is..so you need to pass this logic over in the form of a query versus trying to create the connection local. All query traffic is passed over to the ES and then executed server side. So in this case, I am not sure why you are trying to set the connection yourself anyway. From the looks of the code, it appears that this is within a BO anyway. So there is no need to set the connection, just execute the query.



Public Function ClearPPMTables(ByVal dbName As String) As Boolean



Using cmd As New SqlCommand

cmd.CommandType = CommandType.StoredProcedure

cmd.CommandText = "dbo.sp_ClearTables"

cmd.Parameters.Add("@dbname", SqlDbType.NVarChar, 128)

cmd.Parameters("@dbname").Value = dbName.Trim

Me.ExecuteNonQuery(cmd)



End Using

End Function

Marcel Heitlager
Marcel Heitlager
StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)
Group: StrataFrame Users
Posts: 84, Visits: 835
Hi guys,



When I call the function below, I get a "Format of the initialization string does not conform to specification starting at index 0." error at the line where I set the connection string. I'm trying to clear the SQL Server Tables on the server through ES. Since it works on a local database, what do I need to change so it will play nice with ES? Thanks.





Public Function ClearPPMTables(ByVal dbName As String) As Boolean



Using conn As New SqlConnection



conn.ConnectionString = MicroFour.StrataFrame.Data.DataLayer.DataSources(me.DataSourceKey).ConnectionString

conn.Open()



Using cmd As New SqlCommand

cmd.CommandType = CommandType.StoredProcedure

cmd.CommandText = "dbo.sp_ClearTables"

cmd.Parameters.Add("@dbname", SqlDbType.NVarChar, 128)

cmd.Parameters("@dbname").Value = dbName.Trim

cmd.Connection = conn

Me.ExecuteNonQuery(cmd)



End Using

End Using

End Function
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search