使用webrequest向sql添加数据 [英] adding data to sql using webrequest

查看:195
本文介绍了使用webrequest向sql添加数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的桌面上有一个解决方案文件。我正在关注youtube上的系列节目

但是我没有得到视频创作者的回复。我有一个天蓝色的数据库,一个表(联系人)和几行(ID,名称,数字)

我有自己的文件夹中的PHP连接文件。我在哪里放置PHP文件?在解决方案文件夹中?我也在视觉工作室使用xamarin运行使用xamarin android模拟器的应用程序。我有一个片段,显示我运行应用程序时。我输入我的姓名和号码,然后单击创建按钮,它应显示在列表视图中。好吧问题是我无法连接到数据库。我可以在下午发送我的文件片段给某人,而不是占用这个帖子,我真的需要找出如何解决这个问题。

,最后......是的,我在视觉工作室内连接到我的天蓝色数据库。我在我的服务器资源管理器中看到它,但我猜它在php文件连接信息或解决方案中的createcontactdialog.cs文件中的某些内容。如果你点击创建按钮,你会问到解决方案片段。

i have a solution file on my desktop. i am following along with a series on youtube
but i am not getting a reply from the creator of the videos. i have an azure database with one table(Contacts) and a couple rows(ID, Name, Number)
i have the php connection files in their own folder. where do i place the php files? in the solution folder? also im using xamarin in visual studio to run app using the xamarin android emulator. i have a fragment that shows when i run the app. i enter my name and number and click create button and it should show in a listview. well the problem is i cant connect to the database.? i can send snippets of my files to someone in a pm instead of hogging up this thread, i really need to find out how to fix this.
and lastly ...yes i am connected inside visual studio to my azure database. i see it in my server explorer but i guess its something in the php file connection info or in my createcontactdialog.cs file in the solution..in case you ask heres the solution snippet when i click on the create button..

class ConnectionInfo
{
	public $mServerName;
	public $mConnectionInfo;
	public $conn;
	
	public function GetConnection()
	{
		$this->mServerName = 'azure servername.database.windows.net,1433';
		$this->mConnectionInfo = array("Database"=>"testing",                           "UID"=>"azure user", "PWD"=>"azure pass");
		$this->conn = sqlsrv_connect($this->mServerName,$this->mConnectionInfo);
		
		return $this->conn;
	}
}





当然x是一个数字但是为了安全起见。并且继续尝试连接到azure的连接信息。所以我做错了什么..



of course the x is a number but for security here. and heres the connection info trying to connect to azure..so what am i doing wrong..

void mButtonCreateContact_Click(object sender, EventArgs e)
       {
           mProgressBar.Visibility = ViewStates.Visible;

           WebClient client = new WebClient();
           Uri uri = new Uri("http://192.168.x.x/CreateContact.php");
           NameValueCollection parameters = new NameValueCollection();

           parameters.Add("Name", txtName.Text);
           parameters.Add("Number", txtNumber.Text);

           client.UploadValuesCompleted += client_UploadValuesCompleted;
           client.UploadValuesAsync(uri, parameters);
       }

推荐答案

mServerName ;
public
mServerName; public


mConnectionInfo ;
public
mConnectionInfo; public


conn ;

公共函数GetConnection()
{
conn; public function GetConnection() {


这篇关于使用webrequest向sql添加数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆