English 中文(简体)
提交数据库的数据类型
原标题:Datatype for submit to database

我通过妇女论坛服务,将文字箱和检查箱的内容发送到我的数据库。

迄今为止,我已经说过:

  • fNameTxtBox.Text, - string
  • (DateTime) BirthDate.Value, - System.DateTime
  • toggle1.IsChecked, - bool

但是,如果数据类型不存在,情况如何?

不幸的是,汽车不能帮助我,当然它不接受<代码>。 页: 1

谁能够伸出援手,让我知道这将是什么?

EDIT:

我在试图完成这一发言。 我期待最终确定主人TextBox,因为这种方法要求它是一纸空文,而来文方是第7号工作文件的正文箱:

    private void addAccountBtn_Click(object sender, RoutedEventArgs e)
    {
    _ServiceClient.AddDriverAsync(fnameTxtBox.Text, snameTxtBox.Text, (DateTime)BirthDate.Value, phonemobNumBox.Text, toggle1.IsChecked, toggle2.IsChecked, toggle3.IsChecked, toggle4.IsChecked, toggle5.IsChecked, toggle6.IsChecked, toggle7.IsChecked, toggle8.IsChecked, toggle9.IsChecked, toggle10.IsChecked, toggle11.IsChecked, toggle12.IsChecked, toggle13.IsChecked, toggle14.IsChecked, toggle15.IsChecked, ownerTextBox.????);
    }

取代吗? 以正确结束或改革这一部分,使之发挥作用。

最佳回答

您需要对客户进行验证,以确保永远不会向您提供服务。 如果价值是惯性,你就可以这样做,如果情况并非如此,就会显示信息。 只有当数据符合验证标准时,才向您提供服务。

public void OnButtonClick(object sender, EventArgs e) {
    int value;

    bool isValid = int.TryParse(textBox.Text, out value);

    if (isValid) {
        // send to WCF
    }
    else {
        // display a message
    }
}
问题回答

你们需要利用固定的阶层,例如,来分配价值。

int.Parse(myTextBox.Text)

注:<代码>。 如果价值不能算作分类账,那么批号(<>/code>)就会成为一种例外情况,因此你可能希望进行适当的验证或例外处理。 参看TryParse

您可认为可在Casting,打字,改装型,和 Parsing上阅读。

采用你所贴出的源代码,您将将其改为:

private void addAccountBtn_Click(object sender, RoutedEventArgs e)
{
    _ServiceClient.AddDriverAsync(
        fnameTxtBox.Text, <snip_lots_of_arguments>, 
        toggle15.IsChecked, 
        int.Parse(ownerTextBox.Text)); //I ve only changed the very last bit here
}




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签