|
That's what you get for blindly copying and pasting code without thinking about it. You're not even ATTEMPTING to figure out what's going on, are you?
That variable doesn't exist in your code because IT'S AN EXAMPLE! connStringTemplate would be replaced by the variable you define in your code that is holding the connection string template that you're searching and replacing the tags in.
Start THINKING!
|
|
|
|
|
Thank you !
I thought that connStringTemplate was a system object that hold the connection string.
Ok but if I declare this variable , how can I set his value to current connection string ?
Thank you !
|
|
|
|
|
|
Thank you !
This is my code for changing the connection String :
Dim connstringtemplate As String = System.Configuration.ConfigurationManager.ConnectionStrings(1).ConnectionString.ToString
Cnstring = connstringtemplate.Replace("{DATABASE}", "MyDB2")
This is My partial class
Partial Public Class MyEntities
Inherits DbContext
Public Sub New(connectionString As String)
If String.IsNullOrWhiteSpace(connectionString) Then
Throw New ArgumentNullException("connectionString")
End If
Database.Connection.ConnectionString = connectionString
End Sub
Entity declaration :
context = New MyEntities(cnstring)
But now on runtime i get an error on the line
Database.Connection.ConnectionString = connectionString
An unhandled exception of type 'System.ArgumentException' occurred in System.Data.dll
Additional information: Keyword not supported: 'metadata'.
|
|
|
|
|
Please , any help what can I do ?
Thank you !
|
|
|
|
|
alejx wrote: what can I do ?
Learn to use the debugger built into Visual Studio.
Obviously, it's compaining about something in the connection string, but there's no way for anyone but YOU to determine what that is.
|
|
|
|
|
Thank you !
The error that I get is :
An unhandled exception of type 'System.ArgumentException' occurred in System.Data.dll
Additional information: Keyword not supported: 'metadata'.
And on my connection string in app.config I have "metadata" keyword :
<connectionStrings>
<add name="DyqaniEntities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string="data source=USER-PC;initial catalog=Dyqani;integrated security=True;multipleactiveresultsets=True;application name=EntityFramework"" providerName="System.Data.EntityClient" />
</connectionStrings>
If metadata is not supported , what can I do for my connection string ?
thank you !
|
|
|
|
|
Did you actually READ with your own eyes the string you got back?? See the little path in there that starts with provider connection string ?? What do you think that is between the double quote marks?
Think about that for a while.
|
|
|
|
|
I'm sorry !
I can't understand.
The original string from app.config is :
<connectionStrings>
<add name="DyqaniEntities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string="data source=USER-PC;initial catalog={Database};integrated security=True;multipleactiveresultsets=True;application name=EntityFramework"" providerName="System.Data.EntityClient" />
</connectionStrings>
After the replace instruction :
Cnstring = connstringtemplate.Replace("{DATABASE}", "MyDb2")
The string become :
add name="DyqaniEntities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string="data source=USER-PC;initial catalog=MyDB2;integrated security=True;multipleactiveresultsets=True;application name=EntityFramework"" providerName="System.Data.EntityClient" />
The only thing that I understand from the error message is that on the connection string there is metadata keyword that is not supported (according to error message).
Please tell me what's wrong
Thank you !
|
|
|
|
|
I've given you everything you need. I've told you exactly where to look. No, I'm not spoon feeding you this stuff and I am not writing your code for you. I've got my own 50,000 line app I've got to get running.
|
|
|
|
|
|
Good friends! Please I need your help. Is it possible to write a program that can get scanned document contents, then paste it on a textbox using vb.net or vb6.0? That is, if you scan hardcopy of ms word so that you can save typing time by just editing it using any program. Can this application be develop with vb6.0 or vb.net? Please help!!!
|
|
|
|
|
This can be made, but is is quite complicated and you would reinvent the wheel. What you need is an OCR API or software, have a look at this question[^] for more info.
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
Entropy isn't what is used to.
|
|
|
|
|
Hi
Please help me to resolve this issue.
I have configured my DB2 Connection string in Registry with the Instance NAme as DB2 .
My Connection string key contains
Provider , Database , Host name , Protocol , PORT , USERID , PASSWORD , Authenthication.
I have a Code in VB like..
sSQL = UPDATE <stmt>...
Set UPDATECAL = DATALAYER.ExecSQLUpdate(INSTANCE_NAME, sSQL)
Instance name written DB2 as constant.
I am getting failure after executing this..
The connection cannot be used to perform this operation. It is either closed or invalid in this context.
I guess it is not recognizing this connection.
Please help me...if required i will post more information.
|
|
|
|
|
Senthilkumar E wrote: URGENT HELP NEEDED We're volunteers, and this is a public board. Your question is as important as all the others; you've paid the same amount to ask the question.
You're talking about VB6. That product has been discontinued some time ago, so it CANNOT BE URGENT.
Senthilkumar E wrote: I guess it is not recognizing this connection. You want to guess again, or would it be more helpfull to try if you can execute a simple SELECT-statement from a new app using the same connection-string?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hi Eddy
Thanks for your reply.
The product which i am working currently it is vb6 , no matter whether its discontinued , have a request to change the existing Oracle connection to DB2 Connection. If you could help me in any way that would be grateful.
|
|
|
|
|
Senthilkumar E wrote: The product which i am working currently it is vb6 , no matter whether its discontinued It does. Your product might stop working tomorrow, without any notice.
Senthilkumar E wrote: have a request to change the existing Oracle connection to DB2 Connection Did you try to change the connection-string?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
From the error message, it looks like you didn't open the connection or the connection didn't open as expected and your code ate the error somewhere.
For DB2 connection strings, see ConnectionStrings.com[^].
|
|
|
|
|
helo guys!
i'm new to this forum!
i am working on a project and i have 4 textboxes and 2 tabpages on my form.
i wrote my program in such a way that all 4 textboxes MUST be filled before i can go to tabpage2.
here is my problem.
I need textbox1 to be empty and still be able go to tabpage2 even whrn textbox2,3and 4 MUST be filled
any form of help is appreciated.
Thanks
|
|
|
|
|
Then you need to change your program so that it will accept TextBox1 even if it is empty.
|
|
|
|
|
|
Check the contents and if it is empty then continue. I'm not a VB.NET expert so I don't know the exact syntax, but in C# it would be something like:
if (textbox1.Text == "")
else
|
|
|
|
|
Hi Guyz,
I am developing windows metro apps using vb.net and XAML.
I need to convert canvas element which contains ink strokes on it.
I am using the below code :
<canvas x:name="CollectionSignature" height="120" width="350" background="White" margin="0" horizontalalignment="Left">
Vb.Net code :
Public Shared Async Function GetSignatureImageString(oElement As Canvas) As Task(Of String)
Try
Dim o As New RenderTargetBitmap
Await o.RenderAsync(oElement, Convert.ToInt32(oElement.Width), Convert.ToInt32(oElement.Height))
Dim aryData = Await o.GetPixelsAsync()
Dim logicaldpi = DisplayInformation.GetForCurrentView().LogicalDpi
Dim oStorageFile As StorageFile = Await ApplicationData.Current.TemporaryFolder.CreateFileAsync(oElement.Name + ".png", CreationCollisionOption.ReplaceExisting)
Dim oStream As IRandomAccessStream = Await oStorageFile.OpenAsync(FileAccessMode.ReadWrite)
Dim oEncoder As BitmapEncoder = Await BitmapEncoder.CreateAsync(BitmapEncoder.PngEncoderId, oStream)
oEncoder.SetPixelData(BitmapPixelFormat.Bgra8, BitmapAlphaMode.Ignore, Convert.ToInt16(oElement.Width), Convert.ToInt16(oElement.Height), logicaldpi, logicaldpi, aryData.ToArray())
Await oEncoder.FlushAsync()
Dim oBuffer As IBuffer = Await FileIO.ReadBufferAsync(oStorageFile)
Dim aryData1 As Byte() = oBuffer.ToArray()
oStream.Dispose()
oEncoder = Nothing
oStorageFile = Nothing
aryData = Nothing
o = Nothing
Return Convert.ToBase64String(aryData1)
Catch ex As Exception
End Try
End Function
I am getting 'Value does not false within expected range' on 'o.renderasync' method.
Can you please help?
Thanks,
Vinay
|
|
|
|
|
Vinay Sakpal wrote: I am getting 'Value does not false within expected range' on 'o.renderasync' method. Which variable and what is its value, and what is the range it should lie within?
|
|
|
|
|
Ask How to transfer datagridview values to a listview in Visual Basic 6.0, Please help me ! Thankz
|
|
|
|