|
Can somebody help me with this? I am a student and try to learn internet programming with ASP.NET, C#, mySQL on Linux-servers.
I want to convert this code I got from my ISP to a C# code.
I am running an application from ASP.NET written in C# and want to connect to a mySQL database which is running over internet on a linux server.
<%
Dim objConn
Dim objRS
Set objRS = Server.CreateObject("ADODB.Recordset")
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString="DRIVER={MySQL};SERVER=localhost;"_
& "DATABASE=[DATABASE_NAME] ; UID=[DATABASE_NAME] ; PWD=[MySQL-PWD];"
objConn.Open
objRS.Open "[PASTE-QUERY-HERE]", objConn, 3,3
objRS.Close
Set objRS = Nothing
objConn.Close
Set objConn = Nothing
%>
The code is like following:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="myWebApplication._Default" %>
<title>myWebApplication
|
|
|
|
|
adodb is not ADO.Net I think
The easiest method is to set up an ODBC connection and use the ODBC connection classes with .NET.
File Not Found
|
|
|
|
|
I found following link:
href="http://dev.mysql.com/downloads/connector/net/5.0.html"
From there I installed:
- Connector/Net
- Visual Studio .NET plugin
In the mySQL.Data Help file I found the following code for inserting a row in a table:
public void InsertRow(string myConnectionString)
{
// If the connection string is null, use a default.
if(myConnectionString == "")
{
myConnectionString = "Database=Test;Data Source=localhost;User Id=username ; Password=pass";
}
MySqlConnection myConnection = new MySqlConnection(myConnectionString);
string myInsertQuery = "INSERT INTO Orders (id, customerId, amount) Values(1001, 23, 30.66)";
MySqlCommand myCommand = new MySqlCommand(myInsertQuery);
myCommand.Connection = myConnection;
myConnection.Open();
myCommand.ExecuteNonQuery();
myCommand.Connection.Close();
}
|
|
|
|
|
hi,
i am using a control like numericup/down for my appl'n.
now i want use in time formay like 00:00:00(HH:MM:ss)
i shouldbe in the position to increment/decrement the sec,min and hours.
can u anyone help me pls
with Regards
prasad
|
|
|
|
|
Use a DateTimePicker control instead. Set the following properties:
ShowUpDown = true
Format = Custom
CustomFormat = HH:mm:ss
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
hi,
Thank you
ys it is working
Thank you
|
|
|
|
|
No problem. Glad to help.
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
I got a Bitmap from Icon and save it to a Stream with PNG format
bmp.Save(stream, ImageFormat.Png);
and then I read bytes from the Stream and save bytes to database.
When I read bytes from database and write it to a Stream and create a Image,
if I set the Image to a PictrueBox
pictureBox.Image = MyImage;
it appear correct;
but if I set it to a ImageList and Show in a Listview item
imageList.Images.Add(MyImage)
ListViewItem item1 = new ListViewItem();
item1.ImageIndex = j;//j is the indexnumber of MyImage.
it appear unexpected, just like some blue spots around the pictrue.
What's wrong?
Excuse me for my poor English but i'am really worried about it.
I will put picture comparison on my project website soon.
Please help me,Thx~
http://chinajuanbob.googlepages.com/[^]
http://chinajuanbob.googlepages.com/
http://chinajuanbob.spaces.live.com/
|
|
|
|
|
Make sure your ImageList's ColorDepth property is set to a high value:
imageList.ColorDepth = ColorDepth.Depth32Bit;
|
|
|
|
|
Haha~
Add these code:
Application.EnableVisualStyles();
Application.DoEvents();
and set
Imagelist.ColorDepth = ColorDepth.Depth32Bit;
then it works!
thank you very much!
-- modified at 22:45 Monday 12th March, 2007
http://chinajuanbob.spaces.live.com/
|
|
|
|
|
i have a problem... How can i replace a control present in a container with another control in ComponentAdding/ComponentAdded event? This is required in UndoRedo Operation.I have the undone object with me.On redo an empty control is created with private variables as null.It is a custom control & i am having to reassign all the properties as the undo engine doesnt return the object that was previously removed.
Please suggest a way to get back the Undone control and paste it on the Designer Surface.
|
|
|
|
|
Does anyone have a working example of how to create an active X control that can be hosted in a local HTML document, i.e. not using IIS or a web server, just a plain HTML file that opened in IE will show the active X using WinForms.
Basically I am trying to create a google desktop sidebar gadget, with all the GUI and code being implemented in C#, the google gadget would look very simple
<view ...="">
<object name="myactivex" object="myactivex.mycontrol">
All the samples I have found will not load the Active X in IE, but do in the OLE/Active test harness.
|
|
|
|
|
Hi,
I need to run scrips(vbscripts, jscripts,PowerShell scripts) programatically from C# .Net and I didn't found nothing to help me.
Please help me to do this, giving me a simple exemple.
Thanks,
Lukas22
|
|
|
|
|
You can use System.Diagnostics.Process class to start a process, such as cscript.exe, and pass it parameters (such as the VBScript file).
|
|
|
|
|
Thank you for your solutin, but I have already tested it and unfortunatelly, I need to do this task without using Process.Start(). Is there another solution to solve this?
Lukas22
|
|
|
|
|
You're going to need to run an external process to execute the scripts, unless you write your own script interpreter, which is obviously a huge task. Practically speaking, running an external process is the only option. Why can't you use Process.Start?
|
|
|
|
|
Hi,
Hi I have 3 tables, one is master table( EMP) and other two are child tables (Emp_Dep and Emp_Jone).
Example:
EMP
EmpId Name
1 ABC
2 XYZ
Emp_Dep
EmpId DepId
1 2
Emp_Jone
EmpId JoneId
1 4
I have created these 3 tables and defined Relation objects between these three tables.
My problem is the order of updating in my application,
Case1:
If I update the tables in Emp_jone, Emp_Dep and Emp order, I am getting “constrain failed” exception, when I have add a new employee and linked with a Department and Jone. This would be resolved if I update in Emp, Emp_Jone and Emp_Dep
Case2:
If I deleted an existing employee, who has been liked with some Department and jone, and I update in Emp, Emp_Jone and Emp_Dep, I will get same constrain failed exception, to resolve this I will have to update as specified in Case1 order.
Could you please give me some suggestion to resolve this without any intermediate updates?
Regards,
Satish
Satish
|
|
|
|
|
Hi,
I have a picture box that has mousemove event. I check to see whether the mouse is between certain cords and if it matchs one of the if statements, it should display a tooltip.
The problem is that since im using the mousemove event the tooltip is being redraw everytime the mouse is moved which causes some visual problems, e.g: the picture box displays alot of tooltips.
Any ideas?
Regards,
Gareth.
|
|
|
|
|
Create a boolean field in your class indicating if a tool tip is being shown. Only show a new tool tip if the field indicates there is no tool tip being shown.
|
|
|
|
|
Judah, I cant do that really since i want to show different tooltips for different areas of the picture box, thus i'd need to create a bool for each tooltip which seems like abit of a hash.
Surly theres a better way?
Regards,
Gareth.
|
|
|
|
|
if you use the variable like he suggested, then check the tooltip text to the text you want to show if they are the same don't update otherwise update the tooltip
|
|
|
|
|
Cheers, that fixed the problem.
Regards,
Gareth.
|
|
|
|
|
Hi there
I want to use a session variable to store the user_id, and then redirect to another page. the problem is, that when i get to the redirected page, in the page load event, the session variable is not there (when put onto a textbox). only when the page is refresed (F5), can i view the user_ID on the textbox.
Can anyone help me with this problem?
Thanks
|
|
|
|
|
check the session varaible's value before redirecting to next page
Regards,
Sylvester G
sylvester_g_m@yahoo.com
|
|
|
|
|
Hi,
I am raising RowAdded Event of DataGridView whenever rows are added to the
DGview. But it is raised even for the column Headers. and Column Headers are
also considered as a Row in this case.How can i eliminate this issue.
with Thanks
Sakthi.
|
|
|
|