|
really its a program
i am reading line by line
i have to store some part of code into database so in some circumstance i will display those part to the endusers
some times i have to retrive values from buffer and have to store in database and have to display it later to enduser
for the purpose i need escape character which will store as it and so no need to replace again by searching and all
with regards
Balagurunathan.B
|
|
|
|
|
Hi,
I am sorry, I am trying to help you, but I am not sure what you mean.
Are you trying to read VB.NET code programmatically, and then insert it into a database?
Is the problem that the VB.NET code contains ' characters (comments in VB.NET)?
Does you application need to show existing code to a user, allow the user to modify the code, and if he wants, let the user save the modified code into the database?
In other words, the code may contain ' characters when you have to read it, and/or it may contain ' characters when you insert it (back) into a database?
Please can you clarify?
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
hi
now i will say very clearly
i want to insert a string into database
for eg its a program and i am going to insert in a memo field
the string contains many spl char the single quotes is my big problem( ' )
i want to use some escape char so i can save asit into databse and retrive the content simillar to original string insert
in c# we use @ or \\ wat we will be using in vb.net
with regards
Balagurunathan.B
|
|
|
|
|
If you use a parameterized query, you don't have to worry about escaping this character yourself. The Parameter object will escape it, and many others, for you.
Read up on parameterized queries in Colin's article here[^].
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Well as far as i understand, u need to replace (') by ?('') (two single quotes) before storing it into database.
('') is nothing but the escape sequence for (') in Database (not i \n Vb.net).
I guess this will solve the problem.
"If our Mind can, the Program can !!"
|
|
|
|
|
Private Sub Form1_Closing(ByVal sender As Object, ByVal e _
As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
Dim a%
a = MsgBox("Save and close", MsgBoxStyle.YesNoCancel, )
If a = vbYes Then
MsgBox("yes")
ElseIf a = vbNo Then
MsgBox("no")
ElseIf a = vbCancel Then
MsgBox("Cancel")
End If
End Sub
--------------------------------------------------------------------------
What ever the option I choose the form closes eventually. even if I choose cancel the form closes, is there a way to stop this?
(Yes - file saved then closed)
(No - close without saving)
(Cancel - Cancel)-I don't want the form to close when choosing Cancel.
Pls reply.
Ps
this website Rocks!!!
|
|
|
|
|
Because primarily you have called Form's closing event what is getting initiated to get close the form. In vb.net there is a statement as me.close what closes the form.
Try to use your code out of Form's closing event. In the mean while, try to add "exit sub" where ever you cancel it process.
I hope that helps
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
If you want the form not to close then you need to add:
e.Cancel = True
This is the correct event to do this type of thing.
Ben
|
|
|
|
|
No! because you have already being initiated to form's close event. Eventually it will close it. You can have some codes inside the form's close event but, it will close the form after processing the tasks.
I think you are using VB6 not VB.net therefore I don't remember if there was a statement like e.cancel for closing form.
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
My code is for vb.net and it does work. If this is a vb6 question then I missed that.
Ben
|
|
|
|
|
Here's a link to some microsoft help on this event in vb.net and using the e.Cancel = True
ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETDEVFX.v20.en/CPref17/html/M_System_Windows_Forms_Form_OnClosing_1_84f7c28c.htm
Ben
|
|
|
|
|
If you are using vb.net and
you want the form not to close then you need to add:
e.Cancel = True
This is the correct event to do this type of thing.
Ben
|
|
|
|
|
|
how to get text of selected item in listview?
Please help....
|
|
|
|
|
ListBox1.SelectedItem ' gets or sets teh selected items in listbox
Listbox1.SelectedIndex ' gets the selected item's index number in listbox
Try!
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
how to create sql database in with userdefined name at runtime through vb.net
|
|
|
|
|
Create a connection to the master database on the SQL Server.
Create a SqlCommand that issues the CREATE DATABASE command (see SQL Books on line for details - I've no idea of your situation and I'm not going to second guess).
Then you ExecuteNonQuery on the command.
If the create command worked then you can now connect to your new database.
|
|
|
|
|
about this I have already tried out this it woks well if the database is in sql 2000 but if the database is to be created in sql 2005 it does not allow.
to solve the problem i have tried out many way but could not get it so can explain with some example.
thanx for the support
taher
|
|
|
|
|
Well try using "SQLDMO" dll
This code worked for SQL 2000.
Some code -
Imports System.Data.SqlClient
Imports SQLDMO
'Lists available servers
Private oSqlServer As New SQLDMO.SQLServer
Dim sqlDmoApplication As New SQLDMO.Application
Dim serverList As SQLDMO.NameList
serverList = sqlDmoApplication.ListAvailableSQLServers()
'Create Database
Private Function createDB() As Boolean
Dim oDatabase As SQLDMO.Database
Dim oDBFileData As SQLDMO.DBFile
Dim oLogFile As SQLDMO.LogFile
oDatabase = New Database
oDBFileData = New DBFile
oLogFile = New LogFile
Try
'Delete Database if it exists
Call connectDB()
'If Not IsNothing(oSqlServer.Databases.Item(txtDBName.Text.Trim())) Then
'oSqlServer.Databases.Item(DBToCreate).Remove()
'Response.Write("Database with same name already exists")
'End If
For i As Integer = 1 To oSqlServer.Databases.Count
If txtDBName.Text.Trim().ToUpper = oSqlServer.Databases.Item(i).Name.Trim.ToUpper() Then
lblAlert.Text = ("Database with same name already exists, please mention different name")
Return False
End If
Next
oDatabase.Name = txtDBName.Text.Trim() '"SOM_DB"
' Define the PRIMARY data file.
oDBFileData.Name = txtDBName.Text.Trim() & "Data"
' Replace the following path with your own path to a database folder.
oDBFileData.PhysicalName = "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\" & txtDBName.Text.Trim() & "_DB.mdf"
oDBFileData.PrimaryFile = True
' Specify file growth in chunks of fixed size for all data files.
oDBFileData.FileGrowthType = SQLDMO.SQLDMO_GROWTH_TYPE.SQLDMOGrowth_MB
oDBFileData.FileGrowth = 1
oDatabase.FileGroups.Item("PRIMARY").DBFiles.Add(oDBFileData)
' Define the database transaction log.
oLogFile.Name = txtDBName.Text.Trim() & "Log1"
' Replace the following path with your own path to a database folder.
oLogFile.PhysicalName = "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\" & txtDBName.Text.Trim() & "_DB.ldf"
oDatabase.TransactionLog.LogFiles.Add(oLogFile)
oSqlServer.Databases.Add(oDatabase)
oDatabase = Nothing
oDBFileData = Nothing
oLogFile = Nothing
Return True
Catch ex As Exception
lblAlert.Text = "Error : " & ex.Message()
Return False
End Try
End Function
"If our Mind can, the Program can !!"
|
|
|
|
|
i am again putting up the same question
there is some prob with the behavoiur of vb
in my code i hve placed only one debug statement.. but when i check the immediate wind it shows values twice..
i tried to put break point (anywhere in the code ) that time it showed values only once , but once i remove the break boint it shows values twice again, same happened by putting message box, the big problem is it shows diff values with and without break points
this function is obnly called once in the whole program
Private Sub calculatebalance()
If cheque1 = False Then
balance = instdue * noq + moretorium
ElseIf cheque2 = False Then
Dim previnstdue As Long
previnstdue = rs_clients!clientamounttdue
balance = instdue * noq + moretorium + prevmoretorium + (qtrdiff * previnstdue)
Debug.Print instdue, balance
End If
End Sub
i desparetely need help
can anbdy help me out
mubashir
|
|
|
|
|
Debug.print has two syntaxes. Accordign to your debug statement you have used the second syntax Print (Format as string, ParamArrayArg() as object). That mnight be the issue probably.
Try
debug.Print Instdue.toString
debug.Print balance.toString
also you can use debug.write or debug.writeln
I hope that helps.
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
my prob is not the debug statement , but the values it shows, i mean wiht out break statment my form displays diff values while with breakpoint it displays diff values.. i dont even change a single line of code all i do is put a break stament which changes the values.. dont know how to solve this prob....
|
|
|
|
|
I want to develop a bar chart with the following requirements:
An activity is represented as a box / rectangle with different colors. The colours change according to the activity. The width of the box determines the duration of the activity and is linked to start date and end date in a database record. The order of the activities will be changed by dragging the boxes (in the same row) and the record should be updated automatically. There are many people who are assigned these activities, which are represented in different rows. I should also be able to drag the boxes from one row to another with an immediate update of database.
Could anyone help in telling me the best approach for this task? I am just an intermediate programmer. I hope that my requirement is understandable. Please help me...
|
|
|
|
|
I've tried so many different way's of doing this and I'm sure the solution is simple, I just need a push in the right direction!
Sorry that this post is so long but people usually misunderstand me on this topic.
All I want to do is to establish a client-server connection between two computers of which the one is behind a hardware firewall (A.K.A proxy server). The word PROXY in this case refers to a computer with two NIC's, one to the internet and one to the LAN. This proxy server has a whitelist of allowed sites, ports and protocols.
Eg. Any PC on the lan can connect to www.news24.com, because the website is whitelisted. In the same manner any PC on the LAN can send and receive emails. In the event where a client attempts to access a website not on the whitelist he is promted for a password that will grant the access.
I want users of my app to be able to specify wheter they use a proxy server or not and what the address of that server is. Let's assume the proxy server has been set up to allow communication on that specific port (i.e I'm not trying to trick, hack or bypass the firewall, the connection is legitimate)
A good example of this is MSN Live Messenger, see it's connection setup screen here[^]
My actual question is, how do I implement this proxy into my connection, do I need to connect to the proxy first and then somehow request it forward my connection?
PS. This is not a web-request (eg. http get/post request)
"you can't forget something you never knew..." M. Du Toit
"Watching Migthy Joe Young made me hate my life..................................I want a gorilla!" A. Havemann
|
|
|
|
|
The proxy has to be configured (NOT from your code, but by your proxy server admin) to open a port to the public and forward it to your servers internal IP and port.
If it was so easy to get the proxy to open a hole from code, image what all these Trojan virus writers could do!
Your client would connect to the public IP and this opened port. The proxy then forwards this request to your server on its internal IP and port number.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|