|
Somehow I think you missed my first point entirely. Anyway look here[^].
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
As Luc said, the reason why the formatting isn't preserved is probably because you're storing the string your getting from the RTB's Text property, when you should be storing the RTB's RTF property instead.
|
|
|
|
|
Hi,
I think you're right. Somehow, i manage to fix the codes and I get what i wanted after doing some research. I'll post the complete codes
And again, thank you for your help
<br />
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br />
With Me<br />
Try<br />
Dim ms As MemoryStream = New MemoryStream<br />
'initializing picture<br />
.RichTextBox1.SaveFile(ms, RichTextBoxStreamType.RichText)<br />
Dim bytBlobData(ms.Length - 1) As Byte<br />
ms.Position = 0<br />
ms.Read(bytBlobData, 0, ms.Length)<br />
<br />
Dim DatabaseParameter As New MySql.Data.MySqlClient.MySqlParameter("@BlobData", MySql.Data.MySqlClient.MySqlDbType.Blob, bytBlobData.Length, ParameterDirection.Input, False, 0, 0, Nothing, DataRowVersion.Current, bytBlobData)<br />
If conn.State = ConnectionState.Closed Then conn.Open()<br />
massCommand = New MySqlCommand<br />
massCommand = conn.CreateCommand<br />
massCommand.CommandText = "insert into `test`" & _<br />
"(`mark-2` ) " & _<br />
"values(@BlobData)"<br />
massCommand.Parameters.Add(DatabaseParameter)<br />
massCommand.ExecuteNonQuery()<br />
Catch ex As Exception<br />
writelog("0001", userid, Now.Date.ToString("MM/dd/yyyy"), Microsoft.VisualBasic.Left(Now.TimeOfDay.ToString, 8), "TEST")<br />
Exit Sub<br />
End Try<br />
End With<br />
End Sub<br />
<br />
Private Sub frmTest_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
conn = New MySqlConnection()<br />
'connection <br />
myConnString = "server connection"<br />
conn.ConnectionString = myConnString<br />
conn.Open()<br />
If conn.State = ConnectionState.Closed Then conn.Open()<br />
massDataTable.Clear()<br />
massCommand = New MySqlCommand<br />
massCommand = conn.CreateCommand<br />
massCommand.CommandText = "SELECT * FROM `test` where `mark-1` = 3"<br />
massAdapter.SelectCommand = massCommand<br />
massAdapter.Fill(massDataTable)<br />
With Me<br />
Dim rtfcontent As Byte() = DirectCast(massDataTable.Rows(0)(1), Byte())<br />
If Not rtfcontent Is Nothing Then<br />
Using stream As New IO.MemoryStream(rtfcontent)<br />
.RichTextBox1.LoadFile(stream, RichTextBoxStreamType.RichText)<br />
End Using<br />
End If<br />
End With<br />
End Sub<br />
<br />
|
|
|
|
|
How To Store String As ComboBox's ItemData .
e.g
Dim strSQL as string
strSQL = "select IISC, BRANCH FROM RTGS_BRANCHES"
Set RS = Conn.Execute(strSQL)
Do While Not RS.EOF
cboBankBranch.AddItem RS!BRANCH ' string banch name
cboBankBranch.ItemData(cboBankBranch.NewIndex) = rs!IISC ' is alphanumeric code
rs.movenext
loop
rs.close
here when we assign IISC code as string then its giving error while if it an integer then its working fine. Where i am doing mistake ? Please find out the solution. its urgent.
thanx
Nadeem
|
|
|
|
|
nadeem2003 wrote: its urgent.
I asked everyone here, and we all agreed, it's not urgent to us. Don't be rude, if you want free help, you need to wait until someone feels like giving it.
You should read the post on how to ask questions. Perhaps if you told us the error message, that would help. I suspect the error is telling you that the field needs to be a number. If it says that, then it is true. The comboboxitem class has a tag property you can put a string into.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Christian Graus wrote: I asked everyone here, and we all agreed,
You did? I did?
Damn my memory is failing me again
But I do agree
|
|
|
|
|
Thanx for taking initiatives and ur precious time. See the code below.Here in step one it is executes well without any error but at line no 4 in step 2, its giving type mismatch error. can u test it in ur end. Please help on this issue. thanx once again for giving ut attention , time & effort.
step 1
1. cboAccountType.AddItem "Current"
2. cboAccountType.ItemData(cboAccountType.NewIndex) = "1"
step 2
3. cboAccountType.AddItem "Saving"
4. cboAccountType.ItemData(cboAccountType.NewIndex) = "S"
|
|
|
|
|
hi,
i have insert date in string format.like this
dim todaydate As String = Format(Today, "dd/MM/yyyy")
there is no problem with dates when i insert.
but wen i am using between query its only short days.
For Example,
Item Name Date
hi 10/3/2000
hi1 15/3/2000
hi2 15/4/2000
hi3 18/4/2000
wen i am use between 01/4/2000 to 18/4/2000.. its show all information.
please help me
Yours,
KaNNaN
-----------------------------------------------------------------
"Success is When Ur Signature Becomes An Autograph"
Mail To : foreverkans@gmail.com
|
|
|
|
|
Is this a question that belongs in the SQL forum ? I am confused as to what you're asking, what you're using, and where VB comes in to it.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
If this is a SQL-server then use the "yyyyMMdd" format in the sql string.
Otherwise you can have that sql-server sees the month as the day and visa versa.
|
|
|
|
|
hi,
i got solution...
i have changed dd/mm/yyyy to dd.mm.yyyy
Yours,
KaNNaN
-----------------------------------------------------------------
"Success is When Ur Signature Becomes An Autograph"
Mail To : foreverkans@gmail.com
|
|
|
|
|
Tom above give you much better solution, since "yyyyMMdd" is ISO standard date that sql server understands, if you migrate your sql server to a computer with some other culture set (let's say US) then this date format you wrote "dd.MM.yyyy" is not good, since sql server again does not know which is day and which is month. Either use "yyyyMMdd" or use parameters.
SQL server understands ISO date, and date that is set as it's default culture, and he will behave different on US set server (MM/dd/yyyy) and different for lets say german set server (dd.MM.yyyy).
|
|
|
|
|
I'm new to programming and also struggled with dates and sql a while ago. I tried various date formats but could not get one to work consistently - my day and months would swap around. The yyyyMMdd format worked, but I didn't like the look of it. I then looked into sql parameters and that works perfectly. I would strongly recommend using parameters.
|
|
|
|
|
Hi All,
I have generate problem while i am trying to send mail using guest account.
Error is given Below.
Access to the path 'Global\.net clr networking' is denied
i think it can solution using CASPOL.exe.
So please help me to use CASPOL.exe for applying fulltrust to my application.
Thanks
If you can think then I Can.
|
|
|
|
|
This is STILL not a programming question. It STILL has to do with security configuration on your machine. You STILL do not explain how you're sending mail to get this error. You've had this issue for days, but you can't take the advice you've been given to try to clarify the problem ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
The Guest account has permissions to NOTHING. Run your app under a normal user account instead. Developing for the Guest account is ludicrous since noone ever enables that account, and if they do, they should be taken out back and shot.
|
|
|
|
|
But my software requirement is sending mail BY USING guest account.
If you can think then I Can.
|
|
|
|
|
Unless the admin open up the rights to the Guest account, you're sunk. You simply have no options since the Guest account is not allowed, by default, to do what you want.
|
|
|
|
|
hi, im not very good at deployment and im facing this problem:
I've finished my application and build the executable file using Setup Project. Anytime i want to access the database the application trows an error.
This is my connection:
myConnection = New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\Selom\Documents\Visual Studio 2005\Projects\Printing And Copy1\Printing And Copy1\Database1.mdf;Integrated Security=True;User Instance=True")
Please I need help!
Please i need to know what is wrong with my connection.
modified on Wednesday, July 15, 2009 7:12 AM
|
|
|
|
|
Standard Question #1: What's the error message??
Does this path exist on the machine you're installing the app on:
C:\Users\Selom\Documents\Visual Studio 2005\Projects\Printing And Copy1\Printing And Copy1\Database1.mdf
Somehow, I doubt it. For examples of connection strings and what the proper format for each type of connection to each database would be, consult ConnectionStrings.com[^]
|
|
|
|
|
thanks for replying, actually, this my code:
Private Sub frmColour_Copy_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
Dim con = = New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\Selom\Documents\Visual Studio 2005 \Projects\Printing And Copy1\Printing And Copy1\Database1.mdf;Integrated Security=True;User Instance=True")
Dim cmd As New SqlCommand
cmd.Connection = con
cmd.CommandText = "INSERT INTO customer(cust_name, cust_Age) VALUES( '" + strCustName+ "', '" + strCust_Age + "')"
cmd1.ExecuteNonQuery()
Catch ex As Exception
MessageBox.Show("Error while inserting record on table..." & ex.Message, "Insert Records")
Finally
con.Close()
End If
this code works on the pc it's being developed. the only problem is that after building the executable file using the setup Project and installed on the same machine, it displays the following error:
Format of the initialization string does not conform to specification starting ar index 0
thanks in advance for your help!
|
|
|
|
|
Again, if you didn't change the connection string you used to match where the database is installed on the client machine, you'll get an error like this. You used:
AttachDbFilename=C:\Users\Selom\Documents\Visual Studio 2005 \Projects\Printing And Copy1\Printing And Copy1\Database1.mdf
I'm willing to bet that this path doesn't exist on the machine you installed the app on.
|
|
|
|
|
Again, thanks for replying. You are right about the path.
my only trouble is how to change it so that it works after the installation of the application on any machine.
I have changed it into :
Dim constring As String
constring = Application.StartupPath.ToString() + "\Database1.mdf"
Dim con = New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=" + constring + ";Integrated Security=True;User Instance=True")
and selected the option "embedded resource" for the database file but it still not working and giving the following error code:
"An attempt to attach an auto-named database for file C:\Program File\App\Customerdb.mdf failed. A database with the same name exits, or specified file cannot be opened, or it is located on UNC share."
Thanks for replying!
|
|
|
|
|
You cannot use the database if it's an embedded resource. Even if you could, it would be entirely ReadOnly. You wouldn't be able to add any data to it or modify it in any way.
The fullyqualified path to the database file should be either written to a config file at install-time or generated, using well-known folder paths, at run-time. It's then just a simple matter of inserting the path into the connection string when needed.
|
|
|
|
|
Thanks for keep on replying sir. I'm quite lost. can you please give me a very simple and well detailled sample.
Thanks for replying!
|
|
|
|