String constring = "server=192.168.100.73;database=bd;uid=user;password=pass;";
Oh and before anyone says anything about the ";" after pass, I removed it and like that I can still connect to my database on my local PC.
String constring = "server=192.168.100.73;database=bd;uid=user;password=pass;";
Oh and before anyone says anything about the ";" after pass, I removed it and like that I can still connect to my database on my local PC.
Take out the space between the word count and the left parenthesis.
Also, your table name really isn't "table", is it? That's a reserved word. Also, in order to diagnose your connection string, I would need to see it.
The count works. What doesnt work is connecting to another IP in my local network.
And no; "table" is a example.
My connection string as you request:
String constring = "server=192.168.100.171;database=bd;uid=user;password=pass;";
Replacing the IP with 127.0.0.1 works (I have a MySQL server working on my local machine too). Putting "localhost" also works (just tests, I know there is no difference). Putting my internal IP on the network also works which is 192.168.100.73 (this is very important and glad it works). I once again tried pinging to and from that 171 IP and it works. Just this C# that doesnt want to.
Here is something intresting I discovered with the command line:
Connecting to .73 works. Thats my IP
Connecting to .90 (non existing host) doesnt work and gives a 10060 error.
Connecting to .171 (the host with the MySQL server that I want to connect to) gives the same error message but a 10061 error
Connecting to .71 (a existing host but with no MySQL server installed) gives a 10060 error.
Marking this as unsolved because I cant connect to a PC on my same network.....
I can ping it and it can ping me. None of us have firewalls install on the PC. What can be wrong. The exception says:
Unable to connect to any of the specified MySQL hosts.GUIProject.exe Error: 0 : Unable to connect to any of the specified MySQL hosts.
A first chance exception of type 'MySql.Data.MySqlClient.MySqlException' occurred in MySql.Data.dll
Unable to connect to any of the specified MySQL hosts.The thread '<No Name>' (0x14694) has exited with code 0 (0x0).
No "hi" or anything as you have to act now and quickly.
Microsoft for whatever lame excuse they present, are cutting out previous 25GB storage down to 7GB. So you can compare: Google Music allows 20,000 songs with a 250 MB limit per song which means in theory you can store up to 5TB. Dropbox uses a horrible of 2GB....
So go to https://skydrive.live.com/ManageStorage NOW (Do not even keep reading this post) and claim your free 25GB even if you dont use it for anything because simply you never know.
What kind of a problem is that? Is the number of columns larger than the maximum number of arguments for concat? Or are you just too lazy to type all the names?
No, your suggestion does not work. concat takes string arguments.
Well, there are about 200-300 tables. Im not sure if that reaches the max and/or you would type them ALL out.....
In my library I've got a script found ages ago in the internet. It's for MS SQL server but it might help you get an idea or something. This stored procedure creates a temporary table for storing search result data and steps through each column found. CREATE PROC [dbo].[SearchAllTablesAllColumns]( @SearchStr nvarchar(100))ASBEGIN -- Purpose: To search all columns in all tables for a given search string -- Written by: Francisco Tapia -- Site: http://sqlthis.blogspot.com -- Inspired by: Narayana Vyas Kondreddi -- http://vyaskn.tripod.com/search_all_columns_in_all_tables.htm -- Tested on: SQL Server 7.0, 2000 and 2005 -- Date modified: June 23, 2009 CREATE TABLE #Results (ColumnName nvarchar(370), ColumnValue nvarchar(3630)) SET NOCOUNT ON DECLARE @TableName nvarchar(256), @ColumnName nvarchar(255), @Parse AS INT SELECT @TableName = '', @ColumnName = '' SET @SearchStr = QUOTENAME('%' + @SearchStr + '%','''') WHILE (@ColumnName IS NOT NULL) BEGIN SET @ColumnName = ( SELECT MIN(QUOTENAME(C.Table_Schema) + '.' + QUOTENAME(C.Table_name) + '|' + QUOTENAME(C.Column_name)) FROM INFORMATION_SCHEMA.COLUMNS c INNER JOIN INFORMATION_SCHEMA.TABLES t on c.table_schema = t.table_schema and c.Table_name = t.table_name WHERE T.TABLE_TYPE = 'BASE TABLE' AND C.DATA_TYPE IN ('char', 'varchar', 'nchar', 'nvarchar', 'text', 'ntext') AND …
Confirming it is more of a MySQL error as I did a simply select and it worked.
I feel stupid because Im trying:
SELECT COUNT (*) from table;
In MySQL workbench and it says it is invalid too. That line is perfectly valid right?
The exception is:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'COUNT (*) FROM table WHERE usuario=usuario AND pass=pass' at line 1
Now that I think of it.........isnt it SELECT COUNT(*)....
Trying now....
Hi there.
First, put your connection string in your web.config.
After that, use this code to access it and connect to the db:
1. string query = string.Empty;2. String con1 = ConfigurationManager.ConnectionStrings["ApplicationServices"].ToString();3. MySqlConnection con = new MySqlConnection(con1);4. query = "Your sql query";5.6. MySqlDataAdapter da = new MySqlDataAdapter(query, con);7. DataSet ds = new DataSet();8. da.Fill(ds);
one more thing:
rewrite your catch block to look like :
1.catch(exception ex)2.{3. messageBox.show(ex.message);4.}
Please tell me what is the reported error.
Rotem
My web.config? This isnt a ASP.net project.....
Maybe you ment something else.
I couldn't get that to run. Kept throwing an invalid cast exception when casting Thread.CurrentPrincipal. I did, however, get this to work: var x = new WindowsPrincipal(WindowsIdentity.GetCurrent()); if (x.IsInRole(WindowsBuiltInRole.Administrator)) //You are an admin else //Not an admin
Thanks. Im going to try that out and see if I can get it to work...
Hey
I have the following code
private void buttonInicio_Click(object sender, EventArgs e)
{
MySql.Data.MySqlClient.MySqlConnection conn;
String constring = "server=localhost;database=bd;uid=user;password=pass;";
try
{
conn = new MySql.Data.MySqlClient.MySqlConnection(constring);
string query = "COUNT (*) FROM table WHERE usuario=" + Globales.usuario +
" AND pass=" + Globales.contra;
MySqlCommand cmd = new MySqlCommand(query,conn);
cmd.CommandType = CommandType.Text;
conn.Open();
int num = (int) cmd.ExecuteScalar();
MessageBox.Show("Trying");
conn.Open();
MessageBox.Show(num.ToString());
MessageBox.Show("Fin");
conn.Close();
}
catch
{
MessageBox.Show("Error");
}
}
This code gives me a
"A first chance exception of type 'MySql.Data.MySqlClient.MySqlException' occurred in MySql.Data.dll"
and the MessageBox showing Error pops up.
What could be some possibilities that are happening? All the parameters such as connection to DB and the tables exist so....
Thanks!
Make a form that is derived from a regular form and put that code in it. Then to make forms that use that code just derive them from it. If you want to use it between projects you will need to either make a dll and reference it, or include the whole project each time and reference it (dll's probably easier) public class UnmovableForm : Form{ //...Regular form stuff goes here (might want to seperate the designer code though) public override WndProc()... //your method}public class NewForm : UnmovableForm{ //This form will use that same WndProc() override}
I THINK I understand what you mean.........Im going to have to try it out just in case.
Thanks a lot :)
Hello
Im making a application which needs some administrator priviliges. The thing is that this besides 7 will also run on XP.
Ive been told that changing in the app.manifest the requestedExecutionLevel is one step as this basically will require a admin
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC Manifest Options
If you want to change the Windows User Account Control level replace the
requestedExecutionLevel node with one of the following.
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
Specifying requestedExecutionLevel node will disable file and registry virtualization.
If you want to utilize File and Registry Virtualization for backward
compatibility then delete the requestedExecutionLevel node.
-->
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
</requestedPrivileges>
But the other problem occures in the legacy world: On XP, ive been told this basically means nothing and I have to use a "IsInRole" method. Currently I have this:
static void Main()
{
// AppDomain myDomain = Thread.GetDomain();
// myDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
WindowsPrincipal myPrincipal = (WindowsPrincipal) Thread.CurrentPrincipal;
if (myPrincipal.IsInRole(WindowsBuiltInRole.User))
{
MessageBox.Show("You must be admin to run this");
}
else
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FormPrincipal());
}
}
But it doesnt work (this is in the Program.cs). It simply doesnt allow me to run the program (7 or XP; Simply doesnt let me run and shows the message in the MessageBox).
Any tips?
Thanks!
OK, please relax everybody. @Rutu3
Please show some evidence of having completed some work yourself. Your question is not specific enough either. This is not spam, just a poorly thought out question. So, please rephrase the original question and show any relevant work you've produced so far.
My post was not a "attack" in any way. Posts sadly dont have tones of voices :P
I was simply stating that there is no way to help and no base to help from if more information is not given.
Hope this helps, let me know if you get stuck (c looks like it is a string containing the contact info).
} In which case c is the local variable name used inside the foreach representing a node in contact.Node object.
This completely proves my point: One user thinks c is a string (what I though at first) while the other uses it is a contact.Node object. See how it is confusing?
ChrisHunter, my intention was not to bump and I apoligize if it came out that way. I ment that I will try LINQ to XML, I tried then commented that it isnt easy or well explained...
For now, Im using the registry to store/load data but I dont think its going to be a good idea come localization.
It isnt easy nor well explained...
http://msdn.microsoft.com/en-us/library/bb308960.aspx#xlinqoverview_topic2f
Look at that. It is talking about a variable named "c" What is c? Is it a String? A node? A array of numbers? etc. It doesnt specifiy at all clearly and easy what it is. That I think is a huge error.
Nothing huh.........Ill try with LINQ to XML but that does not look easy at all....
They're not. I never said they were. :) Every individual post is a post. Replies are everything that but the first one in an article. I can reply to a discussion thread. I can also reply to a news story. I can post a new discussion thread. I can also post a new news story.
See here is the thing: You cant reply to a news story as it is not something that is directed for conversation.
Imagine a news story as a sign: A sign says for example "No swimming here". You dont communicate with that because it is a one way conversation. You can COMMENT it saying "I dont agree with it" but the sign
While developed by Facebook, the OPG project is currently being standardized by Google, who is encouraging it to be used on every site on the web as part of a website's SEO efforts. For starters, Xenforo, the new forum system being touted as the successor to vBulletin (written by vBulletin developers when they sold vB two years ago) uses it under-the-hood, although cosmetically they still go by 'thread' on the "start new thread" button itself. Funnily, vBulletin 4 decided to start using OPG directives now as well. vBulletin 4 also recently introduced the ability to create non-thread content which they call articles, a la DaniWeb. Invision Power Board (the other big forum system out there) is now doing the same thing. It's actually really being quite standardized across all major …
No, it's not, but probably the first large one that does ;)
Thats why I mentioned that AFAIK. What other site does this?
Or maybe it's just the only one you've seen that exposes that choice to end users. ;)
Thats a complete different topic.
On the backend of sites, I dont think anyone cares if they are articles, posts, threads, links, etc.....
BUT on the frontend of things, people are used to seeing threads, posts, etc....
1st, spamming is not allowed here and one of the reasons you have been ignored by many is that reason.
2nd, DETAILS. "website as a project so how to create database ,and connect asp page to C# code" is not a explaination of what you are trying to do. Do you want to print information from the database on the page? Do you want to read information from the page and insert it into a database? What database is this? What version of .ASP? DETAILS
3rd, We are not your mother and you are not our child: Spoonfeeding is not something that occurs here.
I hope that my post helps you make your post a lot better. Maybe then someone will help you....
Hello
Im doing this code for every form Ive doing (you have have seen it so I wont explain it)
protected override void WndProc(ref Message m)
{
const int WM_MOVE = 0x0003;
switch (m.Msg)
{
case WM_MOVE:
return;
default:
base.WndProc(ref m);
break;
}
}
How can I do this so I dont have to copy and paste this line over and over and over in every form? I thought of a module but then maybe a user defined form (which I have no idea how to do) which gets from the default form plus this code.
If someone could give a few tips, thanks.
In the world of front-end web development, the Open Graph Protocol, developed by Facebook and standardized by Google, classifies any single body of content as an "article". According to the Open Graph Protocol, available types of "objects" on the web are limited to being classified as one of the following: website, music, video, article, book, profile. Objects of the article type, for example, contain the following properties: published_time; modified_time; expiration_time; author; section; tag. The article type makes the most sense to describe a collection of content on DaniWeb, whether it is a forum discussion thread, news story with comments, code snippet with comments, tutorial, etc. With regards to those pointing out confusion in that an article suggests a "standalone piece" while forum threads are composed of multiple posts, think of it this way: Everything that we do and the way that our rules have always been designed revolves around ensuring that there is no break in flow of conversation. In most ways, an entire discussion is considered one single entity since each post alone is meaningless and out of context. Ultimately, individual posts are not much different than individual sentences extracted from a news story or tutorial.
The link still says "threads" because as such these are still threads. I understand your explanation and even though OPG works for Facebook, its not the same as a thread. In FB for example, there is no formatting, there is no quoting, there is no code posting. The objects (or metatags) …
Um I thought writing code for someone isn't allowd here....
Hey
Im trying to make the typical options box where you cant click the parent (so to speak) box, you can only access the options window unti you close it. For a example of what I mean, in IE, click on Tools and Internet Options. That dialog box is the way I want it to act.
Thank you
Is there maybe a alternative for loading/saving configurations and languages? I mean the first that comes to mind is .ini files but I choose XML as .ini is so........"antique"
But if it is easier to work with, Ill go with .ini
Try using Linq to xml, and check here: http://msdn.microsoft.com/en-us/library/bb308960.aspx#xlinqoverview_topic1a
Man that is a LONG document.........
I wish there was some kind of simply library for C# and working with XML files. Looks like a complete hassle...
The System.Xml.Linq namespace is the easiest to use (in my opinion).
What changes are you expecting to make in different locales/countries?
Languages.....I may not have understood you or you might not have understood me because I think thats why you localization in implemented right?
Ive heard about LINQ but I see it more like "SQL" type thing, non related to localization.
try this to get xml fields to dataset then to gridview:
add namespace : using System.Xml.Linq;
1. DataSet ds = new DataSet();2. ds.ReadXml(Server.MapPath("Events.xml"));3. >GridView1.DataSource = ds.Tables[0].DefaultView;4. GridView1.DataBind();
Well I dont have any intrest in showing the data (at least not yet) but thanks for that :) Like I said I might problably have to use it in the future.
Im going to try to put a example of what I want to do (note that all I put above is invented code)
Lets say I have a XML file like this:
<config>
<languages>
<english>
<id="textboxlabel" value="Yes" />
</english>
<spanish>
<id="textboxlabel" value="Si" />
</spanish>
</languages>
</config>
(I do not even know if that is valid XML. Im just stating it as a example of what I want to do.)
This would be C# code
private void Form1_load()
{
loadvalues(english,textboxlabel.text,"Yes",lang.xml);
}
private void loadvalues(String language,String /*or object*/ nameofobject,String default,String languagefile)
{
//ALL THIS IS PSEUDOCODE
xml x=new xml();
x.loadfile(languagefile.xml);
String text=x.getvaluefor(nameofobject,language);
if ((text=="") || (text==NULL))
{
x.setvaluefor(nameofobject,default)
}
else
{
x.setvaluefor(nameofobject,text);
}
}
Basically that sums up what I want to do.....I hope …
You could use the concat function:
select * from mytable where concat(field1,field2,field3...) like '%searchtext%'
This is highly inefficient, but with small databases it works.
An alternative is to export (dump) the database to a text file and then search with grep or a text editor.
The problem is that there is a large ammount of columns so I can add them. Does
:
Select * from * where concat(*) like 'textimsearchingforhere'
Work?
Hey
I want to search for a text string but I dont know what table or column it is in. I just know the database that it is in. I know also that the type is a text type.
Any query I can do or in MySQL Workbench?
Thanks!
Hey
What is the easiest way to read and write XML file to my C# program? Im looking for
Localiziation
Configuration
I imagine that the only difference is that I have to load the localization as soon as I load the program....
Thanks! :)
Hey
Im thinking of WPF but standard Windows Forms are more used so more libraries are avaliable.
Would you switch to WPF forms or still use Windows Forms?
Thanks!
Hey
That topic title was difficult to write.
Lets say Provider A has the domain name of example.com and hosts a webpage with links such as example.com/aboutus, example.com/wherearewe, etc. Thats all great.
But I want Provider B to host a online store with links such as example.com/store, example.com/storename/shirts, example.com/storename/pants, etc but I still want the domain to belong to Provider A.
I talked to both providers and they said it was possible: B told me I would just have to change the DNS B gives me on A. A told me that it was possible and basically the same: I would have to put in A the DNS B gives me. BUT A mentioned something: If I change the DNS, I would NOT be able to access the website anymore since it points to another DNS (which is B) and It needs to point to the DNS given by A to be able to access the webpage. Basically I would only be able to access the online store.
The reason I ask this here is because the website is a regular website and the other store is a Magento store.
How can I do this? Better yet, is this even possible?
No one has any idea after the last post?
If it ain't broke, don't fix it...
I tried using the basic quote tags and they don't work and are displayed literal....
Thank you for trying to help :) Better to post something than nothing at all....
I used VisualSVN which works OK........
Im kind of confused because now Im posting Articles instead of threads, posts, etc....and when I try to use tags and stuff, it doesnt act like it normally does.
Any way to go back to the old way?
BTW, Im not sure what happen to the forums but its kind of weird....
Hello sir,
Tell me what your getting finally , if any error means please mention that error man,
and in your procedure you are using SQLSTATE '42000' which means Db access deny error ,
i don`t know for what situation you are using that sql state exception
Im not even getting a error. It just doesnt update.
Im trying this as well:
-- --------------------------------------------------------------------------------
-- Routine DDL
-- Note: comments before and after the routine body will not be stored by the server
-- --------------------------------------------------------------------------------
DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `linkacorte`(vid_pedido int(11), vid_producto int(11),vtiempo varchar(50),vid_pastelero int(11),vcorte varchar(200),vnum int(2))
begin
DECLARE EXIT HANDLER FOR SQLSTATE '42000'
SELECT 'Ha introducido un campo incorrecto. Solo se permite 1,2 o 3';
if vnum=1 then
set @sqltext=concat('UPDATE pedidos_productos SET programa_corte_1=',vcorte,' WHERE id_pedido=',vid_pedido,' AND id_producto=',vid_producto,' AND tiempo=',vtiempo,' AND id_pastelero=',vid_pastelero);
elseif vnum=2 then
set @sqltext=concat('UPDATE pedidos_productos SET programa_corte_2=',vcorte,' WHERE id_pedido=',vid_pedido,' AND id_producto=',vid_producto,' AND tiempo=',vtiempo,' AND id_pastelero=',vid_pastelero);
elseif vnum=3 then
set @sqltext=concat('UPDATE pedidos_productos SET programa_corte_3=',vcorte,' WHERE id_pedido=',vid_pedido,' AND id_producto=',vid_producto,' AND tiempo=',vtiempo,' AND id_pastelero=',vid_pastelero);
else
CALL raise_error;
end if;
prepare stmt from @sqltext;
execute stmt;
deallocate prepare stmt;
#update pedidos_productos set @campo=vcorte where id_pedido=vid_pedido and id_producto=vid_producto and tiempo=vtiempo and id_pastelero=vid_pastelero;
commit;
end
But still nothing....
FINALLY!!!!!!
Follow this: http://stuffthatspins.com/2011/01/08/ubuntu-10-x-completely-remove-and-clean-mysql-installation/ Works like a charm. Used it on Ubuntu 12.04 and still worked.
Now this:
120411 8:47:23 [ERROR] /usr/sbin/mysqld: Can't find file: './mysql/user.frm' (errno: 13)
ERROR: 1017 Can't find file: './mysql/user.frm' (errno: 13)
120411 8:47:23 [ERROR] Aborting
120411 8:47:23 InnoDB: Starting shutdown...
120411 8:47:24 InnoDB: Shutdown completed; log sequence number 1595675
120411 8:47:24 [Note] /usr/sbin/mysqld: Shutdown complete
start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error al procesar mysql-server-5.5 (--configure):
el subproceso instalado el script post-installation devolvió el código de salida de error 1
dpkg: problemas de dependencias impiden la configuración de mysql-server:
mysql-server depende de mysql-server-5.5; sin embargo:
El paquete `mysql-server-5.5' no está configurado todavía.
dpkg: error al procesar mysql-server (--configure):
problemas de dependencias - se deja sin configurar
No se escribió un informe «apport» porque el mensaje de error indica que es un mensaje de error asociado a un fallo previo.
Se encontraron errores al procesar:
mysql-server-5.5
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
Did not work. /etc/my.ini, /etc/my.cnf did not exist.
Look for the value of datadir in /etc/mysql/my.cnf or /etc/my.cnf, respectively. Usually it's > /var/lib/mysql.
Unintall mysql with apt-get.
Delete this data directory with all subdirectories.
Delete all in /etc/mysql and /etc/my.ini, /etc/my.cnf etc.
Re-install mysql.
Ill try this tommorow at work. Its really getting annoying...
Thanks :)
Hey
Im trying to start from scratch a MySQL installation in Linux but for some reason through apt-get and the software center, when I remove it, my users (and privileges) still exist. How can I remove everything releated to MySQL and start from 0?
Thank you
Hey
Ive been literally killing myself looking up guides but most are way outdated and/or complicated. I tried a few simply ones but they simply appear to be out of date.
Can someone point me on a easy way to set it up in Windows? Ive been trying to use (as a client) TortoiseSVN but I simply cant get it to work. So I need something simply and easy.....
Thanks a lot!
This code
InetAddress adr=InetAddress.getByName("173.194.35.133"); //Google.com
redexterna=adr.isReachable(3000);
System.out.println("Value 1 " + redexterna);
adr=InetAddress.getByName("192.168.2.3"); //A IP on my local network that does NOT exist
redinterna=adr.isReachable(3000);
System.out.println("Value 2 " + redinterna);
Thread.sleep(5000);
Both give me false. Pinging to google works and pinging to that IP doesnt work in CMD....
Just to make sure :)
What is "inet.isReachable(3000);"???
Hello
I feel stupid for actually asking this but how do I ping a IP address in Java?
I have this code
try
{
// Google.com
if (InetAddress.getByAddress("173.194.35.133".getBytes()).isReachable(1000)==true)
{
//Boolean variable named network
network=true; //Ping works
}
else
{
network=false; //Ping doesnt work
}
}
catch (UnknownHostException e3)
{
System.out.println("ERROR: DNS server error " + e3.getLocalizedMessage());
}
catch (IOException e3)
{
System.out.println("ERROR: Some other error " + e3.getLocalizedMessage());
}
The reason I use a IP address instead of a more common host name is because I have to also ping a internal 192.168.100.3 address which does not have a host name so Ill just do it more universal and just use IP addresses.....
It works for 2 users :)
But not for 6 (3 browsers on each PC calling the web service)
An out of bounds exception sounds like a coding error. Check your logic.
Sometimes it is a out of bound exception, other times it is a file error when trying to read/write/delete/move a file named the same but with different contents.........
So many things...