w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
While Sending Html Mails from my web application Recieved Mails contains Symbols like &ldquo,&rdquo, ‘
Check with another constructor for htmlView: ContentType mimeType = new System.Net.Mime.ContentType("text/html"); var htmlView = AlternateView.CreateAlternateViewFromString(bodyMessage, mimeType);

Categories : Asp Net Mvc

Visual Basic Connecting to Database
performQuery function is faulty. It never closes the connection (Return dbDataReader happens before connection is being closed). On one hand - it's a good thing, because DataReader is useless without open connection. On the other - connection is opened as a private variable inside of a function so it goes out of scope when the function is returning and you never know when Garbage Collector will decide to collect it. It's always fun when this happens in the middle of Reader.Read.

Categories : Database

Connecting To A Database Via Class Object Visual Basic 2010
The problem is that your 'connect' class has no relationship to your 'insert' function, meaning you are creating a new connection in each one. What you would have to do is create a Shared connection to your database that your connect class would manage, and your 'insert' function would use the existing connection. There is nothing wrong with separating code into various sections, but you must know how to do it efficiently. I typically keep connection management and query execution in the same sections to avoid passing around extra objects. Here is what I would do: Imports MySql.Data Imports MySql.Data.MySqlClient Public Class QueryManager Dim dbCon As MySqlConnection Public Sub ManageConnection(ByVal CloseConnection As Boolean) Try 'Prepare connection and query' dbC

Categories : Mysql

Format of the initialization string does not conform to specification starting at index 0 visual web developer
You must use same name in web.config and code behind to ConnectionStrings name. string ConStr = ConfigurationManager.ConnectionStrings["SRM_MetricConnectionString"].ToString(); using (SqlConnection conn = new SqlConnection(ConStr)) { // ...

Categories : Asp Net

Datetime parsing throw Format Exception error
When using DateTime.Parse(), if you want it to parse dates using a format other than the culture the program is running under, you need to specify an IFormatProvider as the second argument to specify which incoming date format you are expecting. Example: cmd.Parameters.Add("@createdon", SqlDbType.DateTime).Value = DateTime.Parse(createdon, new CultureInfo("en-US", true)); This will parse dates in dd/MM/yyyy format, the default format for the US.

Categories : C#

Gah!! Error 424 runtime error : Object required Word Visual Basic
My.Computer is VB.NET which is entirely different from VBA instead you can; Function readFile(path As String) As String Dim hF As Integer hF = FreeFile() Open path For Input As #hF readFile = Input$(LOF(hF), #hF) Close #hF End Function ... mySQL = readFile("C:sql_query_temp.res")

Categories : Vba

No value given for one or more required parameters visual basic error
It's a problem with your SQL query. The reason for the message is that the SQL parser can't identify a token in your SQL query and interprets it as a parameter for which you need to provide a value. So, you either mistyped some of your field or table names, or you created your SQL the wrong way. I suppose the latter and it should read rs.Open "select * From Reservation where [table_number] = " & tablenumber.text & " and booking_date=" & bookingdate.Text, cn, adOpenStatic, adLockPessimistic because tablenumber and bookingdate are very likely form controls. The above query won't work out of the box as you need to use the correct data types for the SQL query which I cannot infer based on your sparse information.

Categories : Vb.Net

visual basic for application - error handling
Welcome to old school error handling. What you are looking for is either Sub MySub() On Error Resume Next DoMyStuff() End Sub if you want to swallow this issue, e.g equivalent of Try Catch End or Sub MySub() On Error Goto ErrorHandler DoMyStuff() KeepGoing : DoSomeMoreStuffAnyway() Exit Sub ErrorHandler: HandleTheError() Exit Sub You can get the Error number from the variable Err You can also fix and call Resume to go to the next line of code after the error happened You can also do Resume To a lable e.g. Resume KeepGoing in the above. More info here MSDN VBA Error Handling

Categories : Vba

Visual Basic Input Box Loop Error
Assuming DtTable is a DataTable and NewRecord is a DataRow, try adding the very first line inside of loop: NewRecord = DtTable.NewRow() This will create a new data row on every iteration.

Categories : Vb.Net

error when update data ms access using visual basic 2010
Try to use a parameterized query to execute your code. The error message is relative to the fact that you haven't initialized your connection with the information contained in the ConnectionString. Here an example on how to do that...... but...... Dim cmdText = "update data_ruangan set [Name] = ?,Location = ?,Capacity = ?, " & _ "Operational_Hours =?,Information = ?;" Using cn = new OleDbConnection( cnstring ) Using cmd = OleDb.OleDbCommand(cmdText, cn) cn.Open cmd.Parameters.AddWithValue("@p1", txtName.Text) cmd.Parameters.AddWithValue("@p2", txtLocation.Text) cmd.Parameters.AddWithValue("@p3", txtCapacity.Text) cmd.Parameters.AddWithValue("@p4", txtOperational.Text) cmd.Parameters.AddWithValue("@p5", txtInformation.Text) '''' WARNING ''''

Categories : Ms Access

Visual Basic Graphics updating error, Only update on user input
My answer was given to me by a comment: I think that you should not set the Image property in the paint event because it causes the Paint event to fire again which sets the image property, which causes the paint event to fire again, over and over. I'm surprised you're not getting a stack overflow exception. In general you should not do anything in the Paint event that would cause the control to refresh. Set that property outside the paint event and then call pb_key.Refresh() – @ChrisDunaway

Categories : Vb.Net

Runtime error message Index was outside the bounds of the array. for Visual Basic 2010
The problem probably is because of these lines: For i = 0 To SquareWidth For j = 0 To SquareHeight Try using this instead: For i = 0 To SquareWidth - 1 For j = 0 To SquareHeight - 1

Categories : Vb.Net

Visual Basic Excel Macro MessageBox.Show Throws "Object Required" Error
MessageBox.Show is VB.Net. Even though you have tagged it as VB.Net, I believe you are doing this in VBA. Try this MyBox = MsgBox("Stuff", vbInformation, "Title")

Categories : Excel

Basic delay command for Visual Basic
Since sleeping and busy waiting are generally frowned upon, you could do something with an AutoResetEvent: Private ReadOnly _resetEvent As AutoResetEvent = New AutoResetEvent(False) Sub Pause(ByVal milliseconds As Long) Dim waitInterval As TimeSpan = TimeSpan.FromMilliseconds(milliseconds) While Not _resetEvent.WaitOne(waitInterval) ' Waiting! End While End Sub This is not recommended, but here's an example using the System.Diagnostics.Stopwatch class: Sub Pause(ByVal milliseconds As Long) If milliseconds <= 0 Then Return Dim sw As New Stopwatch() sw.Start() Dim i As Long = 0 Do If i Mod 50000 = 0 Then ' Check the timer every 50,000th iteration sw.Stop() If sw.ElapsedMilliseconds >= milliseconds Then

Categories : Vb.Net

When connecting Galaxy S2 to Eclipse LogCat begins to throw out errors like crazy
This is LogCat not ErrorCat. What you see is system log so most of the information there are log entries. Only those with E/ are errors but it again - does not mean anything unless you know what this particular log entry is all about. Read about what log is: https://en.wikipedia.org/wiki/Logfile and then about Android logging to get wider picture: http://developer.android.com/reference/android/util/Log.html

Categories : Android

How to install Visual Basic in Visual Studio ultimate 2012?
Run the installer again or go to Control Panel > Programs > Programs and Features, find Visual Studio 2012, press Change and select Visual Basic from the install options when prompted. Edit: It should ask you on first run which language you want as your default. To reset this you'll need to: Open Visual Studio Go to Tools > Import and Export Settings from the menus, Select the option to reset all settings, press Next, Select Visual Basic Development Settings when prompted to select a default collection of settings. This will set Visual Basic to your default language.

Categories : Visual Studio 2012

COM in a Windows form EXE using Visual Basic/Visual Studio 12
This started as a comment but just kept growing, hopefully i am not off track ... You can only register a dll. So the short answer would be to add a class library to your project and put the com class in there. This would allow you to share the functionality of the class, but not the same instance of that class. I think your problem is that you are trying to establish Interprocess Communications. My immediate suggestion is not to do that, at least at first. For a start you could have your com app interface with a .net class library which would log data. You could then have another project with a .net executable that displays the log, and updates periodically. Now you have .net code on both sides of the fence and can start investigating ways to get them to talk to each other. The hard

Categories : Vb.Net

what kind of array initialization is being done here (Basic Java)?
intentFiltersArray = new IntentFilter[] {ndef, }; is same as intentFiltersArray = new IntentFilter[] {ndef}; and now your question how this initialize IntentFilter[] intentFiltersArray = new IntentFilter[] {ndef }; This will create an array of IntentFilter in onw go. It will define and declare array in single line with array size as 1 because there is only 1 element ndef.

Categories : Java

Connecting Access db in Visual C# express
You need to install the Office System Driver: Data Connectivity Components. Even though it says it is for Office 2007 it works with 2010 also. After you install that from there you should be able to just add a datasource within Visual Studio.

Categories : C#

Connecting to a database in Visual Studio
Yes, the database can be remotely hosted, I'have this working on my local machine with a remote MsSql database. Make sure the remote database server accepts connections from your IP. I'm pretty sure the MsSql Server Management Studio is only for MsSql, not MySql. The server name in my case is the IP for the remote MsSql database server, further you need the login and password for your database. But if you use your remote MySql, you don't need this tool. I have no experience with MySql, but it must be possible to use the database in your Visual Studio project with the correct "connectionstring". The connectionstring contains the type of the database, where it is located, login and pasword, etc. You can find the syntax of you connectionstring here: www.connectionstrings.com/mysql/

Categories : Mysql

Visual Studio 2012/2013 in-class member initialization
No, non-static data member initializers not supported by Microsoft compiler. Herb Sutter announced that it will be implemented in Visual Studio 2013 RTM. (Link) Mr. Sutter said that main reason for such a delay in implementing C++11 features is that Microsoft trying to implement C++14 features same time, because they are tightly coupled. So, probably, we will gain some C++14 features in VS2013 release too. Other major compilers: GCC supports it (it is first complete C++11 compliant compiler since version 4.8.1 ) Clang supports since version 3.0 Intel supports since version 14

Categories : C++

How to use Lib like Visual Basic in C#
It sounds like the library is a native library (i.e. unmanaged code, not .NET). You will need to P/Invoke to call into it. You can find a basic introduction to this here. You will need some additional information (perhaps from your colleague's VB project) to correctly declare the library functions you want to invoke.

Categories : C#

Connecting to MySQL database with visual studio 2012
I have not written in C# but in VB the connection would be: Dim Mysqlconn as MySqlConnection Mysqlconn = New MySqlConnection Mysqlconn.ConnectionString = "server=yourservername;User Id=user;password=password;Persist Security Info=True;database=database name" I'm sure the code would be similar. Also as Prix said i would place inside a try/catch block. as for the issue with connecting via the tool menu... did you install the MySql ODBC connectors? this might be why its closing. also check the MySql issue log because not all versions of the ODBC connector are compatible with the msql extension in visual studio 2012

Categories : Mysql

Is connecting to an SQL server over LAN from VIsual Stuios "Add Connections" all it takes
Change the "Data Source" to "Microsoft SQL Server (SqlClient)" using the button "Change". Enter your credentials. Press "Test Connection". EDIT: The Sql Server computer has to have several things done to it to allow remote connections. Here is a full write up: http://blogs.msdn.com/b/walzenbach/archive/2010/04/14/how-to-enable-remote-connections-in-sql-server-2008.aspx Note, if that article does not exist in the future......just google "enable remote connections sql server" and you'll find multiple articles.

Categories : SQL

Is std::atomic_flag static initialization thread safe in Visual Studio 2012?
Section 6.7.4 of C++11 states that variables with static storage duration are initialized thread-safe: If control enters the declaration concurrently while the variable is being initialized, the concurrent execution shall wait for completion of the initialization. But neither of VC++ 2012 or 2013 Preview implement this, so yes, you'll need some protection to make your function thread-safe. C++11 also says this about ATOMIC_FLAG_INIT, in section 29.7.4: The macro ATOMIC_FLAG_INIT shall be defined in such a way that it can be used to initialize an object of type atomic_flag to the clear state. For a static-duration object, that initialization shall be static. VC++ does happen to implement this properly. ATOMIC_FLAG_INIT is 0 in VC++, and VC++ zero-initializes all statics at appl

Categories : C++

fprintf, error: format not a string literal and no format arguments [-Werror=format-security
You should use fputs(Usage, stderr); There is no need to use fprintf if you arn't doing formatting. If you want to use fprintf, use fprintf(stderr, "%s", Usage); The default compiler flags on Ubuntu includes -Wformat -Wformat-security which is what gives this error. That flag is used as a precaution against introducing security related bugs, imagine what would happen if you somehow did this: char *Usage = "Usage %s, [options] ... "; ... fprintf(stderr, Usage); This would be the same as fprintf(stderr, "Usage %s, [options] ... ]"); which is wrong. Now the Usage string includes a format specifier, %s, but you do not provide that argument to fprintf, resulting in undefined behavior, possibly crashing your program or allowing it to be exploited. This is more relevant if the string yo

Categories : C

cocos2d-x-2.1.4 : error: format not a string literal and no format arguments [-Werror=format-security]
Note that cocos2d-x-2.1.4 may not be compatible with ndk-r9, have you try out r8e instead? You can also put this in your Application.mk to disable treating those warnings as errors: APP_CFLAGS += -Wno-error=format-security There are more solutions for the same problem in this thread: http://www.cocos2d-x.org/boards/6/topics/32437?r=33260#message-33260 reference: http://www.cocos2d-x.org/boards/6/topics/33525?r=33579

Categories : Android

Format of the initialization string does not conform to specification starting at index 128
Your path needs an @ sign in the front of it to escape your backslashes: There is a null-terminating character () after the 'E:' in it causing your issue when it's concatenated to your connection string. Change this: string path = System.IO.Path.GetFullPath("E:9-2013SalesRepOpenleads.xlsx"); To this: string path = System.IO.Path.GetFullPath(@"E:9-2013SalesRepOpenleads.xlsx"); And you should be fine.

Categories : C#

XML name expected in Visual Basic
I don't understand the error either, but it's probably an error caused by the invalid syntax. AndAlso doesn't quite work with the sytnax you've used. You need a full, valid expression on both sides: if (total >= 0) AndAlso (total <= 20) Then Note the use of the total variable on both sides of the AndAlso operator. (I've added the parentheses just for clarity.)

Categories : Visual Studio 2012

How to get element by name in .net visual basic
If I understand you correctly, you will need to do something like this: Dim myInput As HtmlInputControl = CType(e.Item.FindControl("123"), HtmlInputControl) Then do stuff with the input you just created myInput.Enabled = False OR You could just add runat="server" to your element <input id="123" name="**123**" runat="server"> and then just reference the element by its id server side as long as the function you're referencing your element in isn't a shared function (if it's shared, you'll need a new instance of the class it was created in to reference it). 123.Enabled = False Also, I'm not sure if you're just doing it to show the example, but you might run into some surprises if you use asterisks in your element names due to it's use as a

Categories : Dotnet

Visual Basic how to use for strucure?
If they are named consistently (e.g. TextBox1, TextBox2, TextBox3), then you can do it like this: For i As Integer = 1 To nrnote Dim t As TextBox = CType(Me.Controls("TextBox" & i.ToString()), TextBox) t.Visible = True Next Otherwise, you could add the text boxes to an array, like this: Dim textBoxes() As TextBox = { FirstTextBox, SecondTextBox, ThirdTextBox } For i As Integer = 1 To nrnote textBoxes(i).Visible = True Next

Categories : Arrays

Visual Basic Loop
You can wrap this code in a loop that goes down each cell in the column, one by one. For example, if you're using column A, Dim row_counter As Long, last_row As Long row_counter = 1 'last_row = whatever your last row is Do While row_counter < last_row '... put looping code here row_counter = row_counter + 1 Loop

Categories : Excel

Visual Basic and MS Excel
Ideally, you'll want to handle all of your errors via the code itself; meaning that if your code throws an error or has received an improper input, the program will display a customized error notifying the user of the issue, or ignore the error. Simple example: Sub ErrorHandling() On Error GoTo DisplayMessage: x = 0 y = 5 / x GoTo TheEnd: DisplayMessage: MsgBox "Your x value cannot be 0" TheEnd: End Sub The code will throw an error because you can't do 5 / 0, but the error will be handled by going to the DisplayMessage: part of the code. However, if you really do need to disable the "Debug" button, you can do the following: Open up the VBA Editor Right-Click on the name of your project (if you haven't changed it, it should be "VBAProject") Select "VBAProject Properties" (Where VBAP

Categories : Excel

Visual Basic Compiler
Can you try it like this: Dim oCompiler as EthernalCompiler = New EthernalCompiler() With { _ .Source = Me.txtSource.Text.Replace("3jkf0dks0", Me.txtPanelId.Text), _ .Target = Target.Console, _ .References = New String() { "System.dll", "mscorlib.dll", "System.Core.dll" }, _ .Icon = Me.OpenFileDialog1.FileName _ }.Compile(Me.txtFileName.Text) oCompiler.Compile(Me.txtFileName.Text)

Categories : Vb.Net

Visual Basic Value of Query
The while is actually looping through all of the items returned into the recordset by the SELECT statement. While Not MyRec.EOF ' While there are emails still in the recordset MyList = MyList & ";" & MyRec![email] ' Append the current email to the list MyRec.MoveNext ' Get the next email in the list Wend Without the While loop and the calls to .MoveNext, you aren't able to retrieve all of the email addresses out of the list. Make sense?

Categories : Vba

Visual Basic Resources
You should probably put this into a case statement Dim ResourceFilePathPrefix As String If System.Diagnostics.Debugger.IsAttached() Then 'In Debugging mode ResourceFilePathPrefix = System.IO.Path.GetFullPath(Application.StartupPath & ".... esources") Else 'In Published mode ResourceFilePathPrefix = Application.StartupPath & " esources" End If 'you name your files Fire.wav, Water.wav or whatever you want. playerStream = ResourceFilePathPrefix & textBox1.text + ".wav" My.Computer.Audio.Play(playerStream, AudioPlayMode.Background) or you could reference it directly: Try My.Computer.Audio.Play("C:TEST" & textBox1.text,AudioPlayMode.Background) Catch ex As Exception MsgBox("The file does not exis

Categories : Vb.Net

visual basic do while input
dont use key_press. use key_up. in event args you will find keycode. for enter the code is 13. so when keycode = 13, extract textbox1.text to a variable. then clear the text box like textbox1.text = "". when ever you do this, increment a member variable by one. by that variable you will know how many values have been entered.

Categories : Vb.Net

How to get what's using the COM Port Visual Basic (.NET)
Here I found a link where your question is solved: Msdn forum It uses Windows Management Instrumentation to retrieve the data you want from the ports. This way you will retrieve the full name of the port, including the part you want. Here is the code: ' Add reference to System.Management.dll. Try Dim searcher As New ManagementObjectSearcher( _ "rootcimv2", _ "SELECT * FROM Win32_SerialPort") For Each queryObj As ManagementObject In searcher.Get() MsgBox(queryObj("Name")) Next Catch err As ManagementException MessageBox.Show("An error occurred while querying for WMI data: " & err.Message) End Try

Categories : Vb.Net

Visual Basic .Net encoding
Use: webber.Encoding = Encoding.GetEncoding(949) (I'm surprised WebClient doesn't use the headers in the response to determine which encoding to use. It's possible that it does, and that the encoding specified here is only used if the response doesn't specify anything, of course.)

Categories : Vb.Net

Connecting to external mysql database through C#/Visual Studio 2012
I had developed one application in c# in that I had used MySQL database as back end that stored at bigrock.com. In your application their will be simple mistake in connection string. And turn off your firewall and your antivirus settings to off. This is the right format of MySQL database connection string :- string connectionString = "Server=Your_Server_Name;Uid=Your_User_Name;Database=Your_Database_Name;port=Your_Port_No;Pwd=Your_Password;Allow Zero Datetime=true";

Categories : C#



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.