本文介绍了检查mysql db中是否已存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好我想检查我的表中是否已经存在文本如果存在不插入且如果不存在则插入它
i write命令只是为了插入我不知道在插入之前如何检查
hi guys i want to check if text already exist in my table if exist don't insert and if doesn't exist insert it
i wrote command just to insert i don't know how to check before inserting
MySqlConnection conect = new MySqlConnection(connectionString);
conect.Open();
MySqlCommand cmsd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
lochwidTxt.Text = HWDI.GetMachineGuid();
cmd.CommandText = "INSERT INTO userprof (u_name, u_pass, u_ip) " + " Values ('" + textBox1.Text + "', '" + textBox2.Text + "', '" + lochwidTxt.Text + "')";
我尝试过:
检查是否已存在(如果它不存在)插入
What I have tried:
check if already exist if it doesn't exist insert it
推荐答案
这篇关于检查mysql db中是否已存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!